Mรณdulo 26 ยท Data Structures & Problem-Solving โ Lecciรณn 7 de 7 ยท ~11 min
Hashing Patterns (capstone)
The hash map is the LeetCode swiss-army knife
Most 'medium' array/string problems come down to one of three hash-map moves:
- Frequency counts: how many times does each item appear? (
collections.Counter)
- Grouping by a canonical key: bucket items that share some derived key. (
collections.defaultdict(list))
- Seen-sets: have I encountered this before? (a plain
set, as in Two Sum and graph traversals)