Pls tell me why this code is not passing 3 test cases.
Tell the error and make suitable changes in code and pls check that code is passing all test cases or not
PLS resolve as soon as possible
@AMAN-2000 hey the order of elements should be strictly increasing. Use greater than instead of greater than equal to.
If this resolves your doubt mark it as resolved.
@Abhinav2604 @AMAN-2000,
Yes, but that would result in WA, but his algorithm is O(N^2), it will give TLE anyways, for N=10^5.
Think of O(N) or O(NlogN) algorithm.
@abhijeet.srivastava6499 Actually their does exist one method in O(nlogn) but this problem will pass O(n2) I guess wrong constraints are written for the problem
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.