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

findDupe isn't O(1), it's O(n) since it has to look at all the elements in the list.


It's O(1) space complexity but O(n) time complexity.


Oh sorry, that's right, I just assumed parent was referring to time.




Consider applying for YC's Summer 2026 batch! Applications are open till May 4

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

Search: