Frequency Queries

  • + 1 comment

    "if n in dic.values()" can start to take too much time if you are doing it too often. Try to store frequencies somewhere instead of searching through your array of values everytime you get a q==3.