I was trying to do this question about removing consecutive letters which are same in string using recursion, but the iterative approach worked better. is it better to do it recursively or iteratively?
Does this question need to be done recursively?
@rdadhich,
You can obviously do both iteratively and recursively. The worst time complexity of a recursive soln will be O(N^2) while worst time complexity of a iterative solution will be O(N).
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.