Coding problems · by pattern

8 hash map problems, solved step by step.

Problems where remembering what you have already seen turns a nested loop into one pass: a map from value to index, a count per key, or a set of seen items. Each one is solved in 22 languages from brute force to optimal, with code you can run on the page.

0/8 solved
  1. Two SumEasy
  2. Contains DuplicateEasy
  3. Valid AnagramEasy
  4. Single NumberEasy
  5. Majority ElementEasy
  6. Group AnagramsMedium
  7. Top K Frequent ElementsMedium
  8. Longest Substring Without Repeating CharactersMedium