2 ms·
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 300
by dclara 13y ago
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.
- platypii 13y agoSorted 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?