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

Looks like one simple change to hashmap may not be the best answer. May I draw the conclusion from your case like that? The best score now went up to almost 3000. I couldn't imagine how many possible ways out there and one of them could be that excellent. Just curious.


Sorted list + binary search was 2000pts and ran much faster than the hashmap solution.


Thank you so much for your info. This is something I'm looking for from the beginning of the discussion.

http://www.algolist.net/Algorithms/Binary_search

This is my original answer! I should not sort the input list though since it's not necessary.

But is string.indexOf() will be even faster?




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

Search: