LeetCode · Arrays & Hashing

Arrays & Hashing Problem Set

Foundation problems covering array manipulation, frequency counting, and hash-map lookups. Master these first — they appear in almost every interview.

Concept pages: Array · HashMap · HashSet
DifficultyPatternProblemKey Insight
EasyhashingLC 1 · Two SumHash map for complement lookup. O(n) time, O(n) space.
EasyhashingLC 217 · Contains DuplicateHashSet membership check. O(n).
EasyhashingLC 242 · Valid AnagramFrequency count with array or hash map. O(n).
MediumhashingLC 49 · Group AnagramsSorted-string key → group values. O(n · k log k).
MediumarrayLC 238 · Product of Array Except SelfPrefix and suffix products without division. O(n).
MediumhashingLC 347 · Top K Frequent ElementsFrequency map + bucket sort or min-heap. O(n).
MediumhashingLC 128 · Longest Consecutive SequenceHashSet for O(1) lookups. Only start from sequence heads. O(n).
MediumarrayLC 36 · Valid SudokuHashSet per row, column, and 3×3 box. O(81) = O(1).
MediumdesignLC 271 · Encode and Decode StringsLength-prefix encoding. O(n) encode and decode.
Mediumsliding-windowLC 3 · Longest Substring Without Repeating CharactersSliding window + HashSet/HashMap. O(n).
MediumarrayLC 189 · Rotate ArrayThree reversals: whole array, first k, remaining n-k. O(n) time, O(1) space.

← Back to all LeetCode categories