I had this question in my test and I couldn’t solve it.
any answer less than O(n2) time complexity is fine.
ex- array = [4,3,12] all sub-arrays = [4], [3], [12], [4,3], [3,12], [4,3,12] expected ans - [4], [4,3,12]
1 <= array length <= 2*10^5
1 <= array[i] <= 200
I was doing it in the companies platform, so I don’t have my code now but it wasn’t passing all testcases and some of them were TLE.
Aditya Patel is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.