Data Structures for Interviews
Interview toolkit in proper order: arrays/Vec, stdin parsing, HashMap ops, sets, sorting, stack/queue/deque, priority queues, and classic patterns.
Submodule 4.1
Arrays & Vec
Fixed arrays, dynamic Vec, indexing, and common interview ops.
- 118 min
Fixed Arrays [T; N]
Stack arrays, length in the type, and when interviews still use them.
- 222 min
Vec Interview Operations
push, pop, insert, remove, get, len, is_empty, clear — complexity and patterns.
- 320 min
Slices, windows & iteration patterns
Subarrays as slices, windows for pairs, enumerate for indices.
Submodule 4.2
Reading Input (stdin)
Ints, strings, multi-line input — competitive programming & interview I/O.
- 122 min
stdin Basics: lines & tokens
read_line, split_whitespace, parse — real stdin vs playground simulation.
- 224 min
Common Input Patterns
n then n lines; n m grid; until EOF; strings with spaces.
- 316 min
Real stdin API (copy-paste for local)
io::stdin, BufRead, fast-ish patterns you will use in contests.
Submodule 4.3
HashMap: Add, Get, Remove
The interview map — insert, update, remove, entry API, frequency maps.
Submodule 4.4
Sets: HashSet & BTreeSet
Membership, uniqueness, intersection-style problems.
Submodule 4.5
Sorting & Custom Comparators
sort, sort_by, sort_by_key, reverse, stable thinking for interviews.
Submodule 4.6
Stack, Queue & Deque
Vec as stack; VecDeque as queue and deque.
Submodule 4.7
Priority Queue (BinaryHeap)
Max-heap by default; min-heap with Reverse; top-k patterns.
Submodule 4.8
Interview Patterns Lab
Wire structures together on classic problems.
- 115 min
Structure Cheat Sheet
Which structure for which problem — memorize this table.
- 228 min
Lab: LRU Cache Sketch (HashMap + order)
Interview favorite: O(1) get/put mental model; implement a simple O(n) version then discuss O(1).
- 325 min
Lab: End-to-End Mini Problem
Parse input, count with map, sort top frequencies, use heap optional.