Frequency Queries

  • + 1 comment

    Actually I'm not sure why but I tested dictionary types a few times in competitions to save a few secs and defaultdict had been always fastest. Weird thing is your use of counter is same with defaultdict but according to python.org it's same with Dict. Here is one of the test links I found, some others says speed difference is bigger.

    https://gist.github.com/dpifke/2244911