Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

The LeetCode version doesn't require linear time, and caps the number of elements to 10^5, so the brute-force O(n^2) time solution seems perfectly acceptable.


Tried it with a simple loop, got time limit exceeded unfortunately.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: