Map (Java) - ShuweiLeung/Thinking GitHub Wiki

1.(846:Medium)(非常经典题)Hand of Straights

  • Intuition:
  1. Count number of different cards to a map c
  2. Loop from the smallest card number.
  3. Everytime we meet a new card i, we cut off i 到 i + W - 1 from the counter,将i到i+W-1值的所有数字频率都减数字i的个数,这样比一个一个减效率要高