Swiggy interview question

time complexity calculation and one coding recursion based.