Cubic Interview Question

what is the problem complexity ?