The testcases are not getting passed although it runs fine on the ide
@mehak61
You are using a O(n^3) approach to solve this problem. As it is mentioned in the constraints
1 <= N <= 100000 that too with atmost 20 testcases , your code is unlikely to pass. You need an O(n) solution. Use Kadane’s algorithm to solve this problem. This is discussed with code in your video tutorials. Kindly refer to it.
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.