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