https://mirror.codeforces.com/contest/1734/submission/173209974
Hi
Please refer to the above submission. I gather it is O(n) solution but I'm getting TLE. When I put print command inside the recursive function, it grows linearly with n.
Can anyone help me understand why I'm getting TLE?
This will run for 19 times thus your solution is not linear with n.It is exponential.