Skip to content

Arrays & Hashing

Overview

Arrays & Hashing is the first section of the NeetCode 150 and the most load-bearing: a hash map + array reasoning pattern appears in most of the remaining categories. Master these nine and you’ve unlocked roughly 30% of the full list’s problem-solving surface.

Problems

  1. 217. Contains Duplicate (Easy)
  2. 242. Valid Anagram (Easy)
  3. 1. Two Sum (Easy)
  4. 49. Group Anagrams (Medium)
  5. 347. Top K Frequent Elements (Medium)
  6. 238. Product of Array Except Self (Medium)
  7. 36. Valid Sudoku (Medium)
  8. 271. Encode and Decode Strings (Medium) (LC premium, also appears as #659)
  9. 128. Longest Consecutive Sequence (Medium)

Bonus problems (same pattern, outside NeetCode 150):

Key patterns unlocked here

  • Hash set for dedup / membership: Contains Duplicate, Longest Consecutive Sequence.
  • Frequency counting: Valid Anagram, Group Anagrams, Top K Frequent Elements.
  • Complement lookup (one-pass hash): Two Sum, and dozens of variants downstream.
  • Prefix / suffix products or sums: Product of Array Except Self.
  • Encoding state into a hashable key: Group Anagrams (char-count tuple), Valid Sudoku (row/col/box keys).
  • Prefix sums for O(1)O(1) range queries: Range Sum Query.
  • Range boundaries in a sorted scan: Summary Ranges.
  • Modular arithmetic for pair counting: Pairs of Songs Divisible by 60.