Are we allowed recursion?


Are we allowed recursion?


Yes, I was able to solve through iterative as well as recursion approach


We can use recursion, But due to the context switching time. it will take more time and memory than the iterative approach.
Therefore it is recommended to use the iterative approach. that will give you correct answer in right time