Swiggy Interview Question

time complexity calculation and one coding recursion based.