Why am i getting TLE

@tusharnitharwal,
Find complexity of your code, you will know why you are getting TLE, also do you think all the problem had asked you was to copy/paste lines. It is more than that.

I did not copy paste it directly. I have made edits to the given function and getting correct output for the given test case. Also the complexity of the code is O(n).

@tusharnitharwal,


Are you sure nested for loop of this type will work in O(n)…??