Time Limit Exceeded doubt

Hi,
Please check.

hello @vatsal50

your solution has O(n^2) time complexity thats why it is giving tle.

try to solve it in O(N)

Its working now. thanks

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.