If you only master one data structure before a coding interview, make it the array. Array interview questions open more FAANG phone screens than any other category, and almost every “harder” topic (sorting, binary search, dynamic programming tables, sliding windows) is an array problem underneath. This hub maps the core techniques to the day lessons and blog posts that teach them.
Why Arrays Dominate Interviews
Interviewers reach for array questions for three reasons:
- Zero setup cost. No class definitions, no pointer diagrams: you can state “given an array of integers…” and be solving within a minute. That matters in a 45-minute slot.
- Smooth difficulty dial. The same problem scales from warm-up to reject-bar: “find the max” becomes “find the max subarray sum” becomes “find the max subarray sum with at most k deletions.”
- They expose fundamentals. Off-by-one errors, boundary handling, index arithmetic, and complexity trade-offs all surface immediately. An array question tells an interviewer in ten minutes whether you actually write code regularly.
The practical consequence: array fluency is not one topic among many. It is the substrate the rest of your prep sits on.
Core Techniques to Master
Most medium-difficulty array questions fall to one of four techniques. Learn to recognize the trigger phrases.
Two Pointers
Keep two indices and move them toward each other (or in the same direction at different speeds) instead of checking every pair. Turns O(n²) pair-scanning into O(n).
Trigger phrases: “sorted array,” “pair that sums to,” “remove duplicates in place,” “container with most water.”
Sliding Window
Maintain a window [left, right] over the array and slide it forward, updating a running aggregate instead of recomputing it. The window grows when the constraint is satisfied and shrinks when it breaks.
Trigger phrases: “longest/shortest subarray such that…,” “at most k distinct,” “maximum sum of a window of size k.”
Prefix Sums
Precompute prefix[i] = a[0] + … + a[i-1] once in O(n); afterwards any range sum is prefix[j] - prefix[i] in O(1). Combine with a hash map to count subarrays with a given sum.
Trigger phrases: “sum of elements between indices,” “subarray sum equals k,” “range queries.”
In-Place Manipulation
Rearrange the array without extra memory: reversal tricks for rotations, swap-to-partition for Dutch national flag, index-as-hash for finding missing numbers.
Trigger phrases: “O(1) extra space,” “modify in place,” “without using a second array.”
Beyond these four, two array-adjacent skills are non-negotiable: binary search on sorted (or partially sorted) arrays, and knowing how the standard sorting algorithms behave, because “sort first” is the correct opening move in a huge fraction of problems.
Learn Arrays Day by Day
The 60-day challenge builds array skills across two clusters (fundamentals in week one, searching and sorting in weeks four and five):
- Day 3: Introduction to Time Complexity: Big O with array traversals as the running example; the vocabulary for everything below.
- Day 4: Introduction to Arrays: memory layout, indexing, insertion and deletion costs.
- Day 5: Multi-dimensional Arrays and Sorting: 2-D arrays, matrices, and first sorting algorithms.
- Day 6: Advanced Sorting (Insertion and Merge): the divide-and-conquer step up from bubble sort.
- Day 25: Binary Search: the O(log n) workhorse, including boundary variants where most bugs live.
- Day 26: Quicksort: partitioning in place; the interview favorite for “explain your pivot choice.”
- Day 27: Mergesort: guaranteed O(n log n) and the merge step that powers a dozen other problems.
- Day 29: Sorting Algorithm Comparison: when to use which, stability, and what your language’s built-in sort actually does.
If you are starting from zero, do Days 3–6 first, drill two-pointer and sliding-window problems for a week, then come back for Days 25–29.
Complexity Quick Reference
Array operations:
| Operation | Time | Notes |
|---|---|---|
| Access by index | O(1) | The array superpower |
| Search (unsorted) | O(n) | Linear scan |
| Search (sorted) | O(log n) | Binary search |
| Insert/delete at end | O(1) amortized | Dynamic arrays |
| Insert/delete at front or middle | O(n) | Everything after shifts |
Core techniques:
| Technique | Time | Space |
|---|---|---|
| Two pointers | O(n) | O(1) |
| Sliding window | O(n) | O(1) or O(k) |
| Prefix sums (build / query) | O(n) / O(1) | O(n) |
| Kadane’s max subarray | O(n) | O(1) |
Sorting:
| Algorithm | Average | Worst | Space | Stable |
|---|---|---|---|---|
| Quicksort | O(n log n) | O(n²) | O(log n) | No |
| Mergesort | O(n log n) | O(n log n) | O(n) | Yes |
| Heapsort | O(n log n) | O(n log n) | O(1) | No |
| Insertion sort | O(n²) | O(n²) | O(1) | Yes |
Array Interview Questions by Difficulty
A representative ladder of the array questions FAANG interviewers actually ask, and the technique each one is really testing:
Warm-up (phone screen openers):
- Two Sum: hash map, or two pointers on sorted input.
- Best Time to Buy and Sell Stock: one pass, track the running minimum.
- Remove Duplicates from Sorted Array: slow/fast two pointers, in place.
Medium (the decision round):
- Maximum Subarray: Kadane’s algorithm; be ready to explain why resetting at negative sums works.
- Product of Array Except Self: prefix and suffix products without division.
- Longest Substring Without Repeating Characters: sliding window with a last-seen map.
- 3Sum: sort, fix one element, two-pointer the rest; the duplicate-skipping is where candidates fail.
- Subarray Sum Equals K: prefix sums plus a hash map of counts.
Hard (senior loops and final rounds):
- Trapping Rain Water: two pointers with running maxima, or a monotonic stack.
- Median of Two Sorted Arrays: binary search on the partition point.
- Sliding Window Maximum: monotonic deque; the classic “window plus ordering” combination.
Notice the pattern: every hard question is two easy techniques composed. If the medium tier feels automatic, the hard tier is assembly, not invention.
A Simple Practice Plan
- Week 1: Days 3–6, plus easy two-pointer problems (reverse array, two-sum on sorted input, remove duplicates).
- Week 2: Sliding window and prefix sums, one technique per session, three problems per technique.
- Week 3: Days 25–29, then binary-search variants: first/last occurrence, rotated arrays, search on answer.
- Ongoing: When a problem stumps you, name which technique it wanted before reading the solution. The naming is the skill.
Related Resources
- Arrays and Lists: Mastering Collections in Python: Python list mechanics, slicing, and comprehensions.
- Arrays and Lists: Storing Data: a gentler first pass at the same ground.
- Binary Search: Not Just for Sorted Arrays: the search-on-answer pattern interviewers love.
- Merge Sort Deep Dive: the merge step, explained properly.
- The Data Structures Cheatsheet: complexity tables for every structure, not just arrays.
- Dynamic programming topic hub: where array skills go next; every DP table is an array.