Arrays & Hashing
This is a premium interview-preparation course on the two data structures every other topic is built on: the **array** and the **hash table**. Most interview problems reduce to one question — can you avoid re-computing something you already know? Arrays let you scan and transform in place; a **prefix sum** turns any range query into two lookups; a **frequency map** or **hash set** trades a little memory for O(1) membership and counting, collapsing an O(n^2) search into O(n). You will start with the mental models (how dynamic arrays amortise growth, why hashing is expected O(1), how collisions are handled), then work through curated problems grouped by the patterns interviewers actually test: prefix sums, frequency maps, in-place array transformations, and hash-backed data-structure design. Every lesson recognises the pattern first, dry-runs a concrete example, then shows a clean Java 17 implementation.
29
Curated lessons
6
Learning modules
7h 13m
Est. study time
10
Target companies
What you'll learn
- Recognise when a prefix sum or difference array replaces repeated range work with O(1) lookups.
- Reach for a hash map or set the moment a problem needs membership, counting, or grouping in O(1).
- Transform arrays in place — marking, sign tricks, and index-as-hash — to hit O(1) extra space.
- Design hash-backed structures (LRU, RandomizedSet, HashMap) that combine maps with arrays or lists.
Your progress
0 / 29
problems completed
29 available now · keep going!
Mark lessons complete as you work through them. Progress is saved on this device and syncs to your account when you sign in.
Learning roadmap
Work top to bottom — each module builds on the last.
- 1
Arrays Fundamentals
Scan, prefix-sum, and count in placeHow arrays store and resize data, the true cost of each operation, and the prefix-sum and difference-array tricks that answer range questions in O(1).
7/7 problems54m - 2
HashMap & HashSet Fundamentals
Trade memory for O(1) lookupWhy hashing gives expected O(1) lookups, how collisions are resolved, and when to choose a map over a set.
4/4 problems32m - 3
Prefix Sum Pattern
Prefix sums + hash map of seen sumsPrecompute cumulative sums so any range or subarray-sum question becomes a constant-time lookup or a single hash-map pass.
4/4 problems1h 7m - 4
Frequency Map Pattern
Hash map for counts, complements, groupingUse a hash map or set to count, look up complements, and group items — the workhorse pattern behind Two Sum and anagram problems.
5/5 problems1h 19m - 5
Advanced Arrays
In-place marking and index-as-hashIn-place transformations and index tricks: prefix/suffix products, using the array as its own hash, and rotating a matrix without extra space.
5/5 problems1h 48m - 6
Advanced Hashing
Hash map + array/list for O(1) designDesign problems that combine a hash map with an array or linked list to hit O(1) operations — RandomizedSet, LRU cache, and building a hash table from scratch.
4/4 problems1h 33m
Modules
6 themed modules from fundamentals to advanced.
Arrays Fundamentals
How arrays store and resize data, the true cost of each operation, and the prefix-sum and difference-array tricks that answer range questions in O(1).
HashMap & HashSet Fundamentals
Why hashing gives expected O(1) lookups, how collisions are resolved, and when to choose a map over a set.
Prefix Sum Pattern
Precompute cumulative sums so any range or subarray-sum question becomes a constant-time lookup or a single hash-map pass.
Frequency Map Pattern
Use a hash map or set to count, look up complements, and group items — the workhorse pattern behind Two Sum and anagram problems.
Advanced Arrays
In-place transformations and index tricks: prefix/suffix products, using the array as its own hash, and rotating a matrix without extra space.
Advanced Hashing
Design problems that combine a hash map with an array or linked list to hit O(1) operations — RandomizedSet, LRU cache, and building a hash table from scratch.
Full curriculum
18 problems and 11 concept lessons in learning order.
- 1Array BasicsArrays Fundamentals Concept
- 2Static vs Dynamic ArraysArrays Fundamentals Concept
- 3Array Time ComplexitiesArrays Fundamentals Concept
- 4Common Array Interview PatternsArrays Fundamentals Concept
- 5Prefix SumArrays Fundamentals Concept
- 6Difference ArrayArrays Fundamentals Concept
- 7Frequency CountingArrays Fundamentals Concept
- 8Hash FunctionsHashMap & HashSet Fundamentals Concept
- 9Collision HandlingHashMap & HashSet Fundamentals Concept
- 10HashMap vs HashSetHashMap & HashSet Fundamentals Concept
- 11Common Hashing Interview PatternsHashMap & HashSet Fundamentals Concept
- 12Running Sum of 1d ArrayPrefix Sum PatternEasy
- 13Range Sum Query - ImmutablePrefix Sum PatternEasy
- 14Subarray Sum Equals KPrefix Sum PatternMedium
- 15Continuous Subarray SumPrefix Sum PatternMedium
- 16Two SumFrequency Map PatternEasy
- 17Contains DuplicateFrequency Map PatternEasy
- 18Top K Frequent ElementsFrequency Map PatternMedium
- 19Group AnagramsFrequency Map PatternMedium
- 20Valid AnagramFrequency Map PatternEasy
- 21Product of Array Except SelfAdvanced ArraysMedium
- 22First Missing PositiveAdvanced ArraysHard
- 23Longest Consecutive SequenceAdvanced ArraysMedium
- 24Set Matrix ZeroesAdvanced ArraysMedium
- 25Rotate ImageAdvanced ArraysMedium
- 26Insert Delete GetRandom O(1)Advanced HashingMedium
- 27LRU CacheAdvanced HashingMedium
- 28Design HashMapAdvanced HashingEasy
- 29Design HashSetAdvanced HashingEasy