Skip to content

Latest commit

 

History

History
124 lines (110 loc) · 9.4 KB

File metadata and controls

124 lines (110 loc) · 9.4 KB

Design

Problem Difficulty Note
705. Design HashSet Easy Fundamental implementation of hash table.
706. Design HashMap Medium Similar solution to 705. Design HashSet, might skip it.
535. Encode and Decode TinyURL Medium Bidirectional mapping.
380. Insert Delete GetRandom O(1) Medium Hash table + list + critical implementation details in remove().
381. Insert Delete GetRandom O(1) - Duplicates allowed Hard HashMap<Int, Set> + list + critical implementation details in remove().
355. Design Twitter Medium Hash table + Heap (Pull Mode)
1396. Design Underground System Medium (1464) Hash table for check-in and route tracking.
146. LRU Cache Medium Hash table + Doubly linked list for O(1) update/evict.

Existance

Problem Difficulty Note
1. Two Sum Easy Hash table for seen, enumerate to find complement.
1679. Max Number of K-Sum Pairs Medium (1345) Variant of 1. Two Sum
1346. Check If N and Its Double Exist Easy (1225) Check n / 2 and n * 2.
633. Sum of Square Numbers Medium Binary search or two pointers or hash table.
532. K-diff Pairs in an Array Medium Check n - k and n + k or n + k only.
923. 3Sum With Multiplicity Medium (1710) (15. 3Sum two pointers) or (1. Two Sum hash table technique).
128. Longest Consecutive Sequence Medium Set + expand only when n - 1 not exists.
36. Valid Sudoku Medium Row, column, sub-box check.

Duplicates

Problem Difficulty Note
217. Contains Duplicate Easy Set for seen.
219. Contains Duplicate II Easy Sliding window [i - k, i]

Counting

Problem Difficulty Note
242. Valid Anagram Easy
169. Majority Element Easy Vote count.
697. Degree of an Array Easy
1002. Find Common Characters Easy Min freq map across all strings.
554. Brick Wall Medium Count edge position frequency.
916. Word Subsets Medium (1624) Max freq map for B, check A >= B.

Mapping

Problem Difficulty Note
290. Word Pattern Easy Bidirectional mapping.
49. Group Anagrams Medium Sort or count as key.

Other

Problem Difficulty Note
138. Copy List with Random Pointer Medium Map old -> new.
133. Clone Graph Medium Map old -> new.

Cycle Sort

Problem Difficulty Key Difference
41. First Missing Positive Hard Finds the smallest missing positive; range is [1..n]
442. Find All Duplicates in an Array Medium Find all elements that appear twice; range is [1..n]
448. Find All Numbers Disappeared in an Array Easy Find all numbers missing from [1..n]
645. Set Mismatch Easy One number duplicated, one missing; range is [1..n]
268. Missing Number Easy One number missing from [0..n]
287. Find the Duplicate Number Medium Range: nums.length == n+1, values in [1..n]; exactly one duplicate

Explanation

The following problems are not covered in the problem listing.