Please tell about this Question.
//And Also I am doing it in O(n2)
Is there any other method to solve in O(N) as I don’t think Even efficient method than O(N) will be present.
Please tell about this Question.
//And Also I am doing it in O(n2)
Is there any other method to solve in O(N) as I don’t think Even efficient method than O(N) will be present.
hello @cbcao263
i checked ur implementation , u made it bit complex.
refer this ( O(n^2) ) ->
yes most of the subarray related problem are solvable using 2 pointer / sliding window.
so try to think of in that direction
Arre Bhai
Kya mast Implementation ki
Yaar but same TLE aarha
two pointer se socho
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.