Its O(n) solution…still giving TLE kindly help
Why is my code giving TLE
i hope u can acsess my code.
@Harsh-Bhardwaj-2240931009333599 your code is correct and is not giving TLE.
it is giving run Error cause you have taken your vector of size m+1 and accessing vector till n.so if n is greater than m it will cause run error. update your vector size accordingly and your code will work fine.
Kindly check my last submission, it was n+1 not m+1
ok now you have taken size as n+1 so in cases where m is greater than n it may give run Error.
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.