Aller au contenu principal

Summaries

Arrays and hashing

Questions usually ask:

  • Scan the data once or few times
  • Remeber what you've seen
  • answer something faster than brute force

What information do I need to remember to avoid re-checking work?

existence → set

count → dict / Counter

index → dict

range sum → prefix sum

grouping → computed key