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

You can do a second pass over the list to check that your solution is actually a majority element. This maintains the linear time and constant space properties.


Unfortunately single pass is usually the binding constraint eg real time data processing.




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

Search: