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

Gee, what a newb. Here's how to do it in O(1):

    return userNamesStr.indexOf(curForwardUserName) >= 0
;)

(I'd love to not have to explain sarcasm, but people have an incredible difficult time understanding it here.)



lol, I was thinking that too -- "but indexOf is faster..."




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

Search: