3 ms·
Sorted list + binary search was 2000pts and ran much faster than the hashmap solution.
by platypii 13y ago
Sorted list + binary search was 2000pts and ran much faster than the hashmap solution.
- dclara 13y agoThank 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 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?