Topic
Arrays interview questions
All 34 Arrays problems from the curated set, easiest first — a core topic for 25 of the 29 engineering roles.
- Easy
- 12
- Medium
- 21
- Hard
- 1
- Sheets
- 3
What Arrays is
Updated 2026-09-09An array is a row of fixed boxes laid side by side in computer memory, like numbered lockers in a hallway. Because each box occupies identical space and sits directly next to its neighbors, jumping to locker zero or locker ten thousand takes the exact same tiny fraction of time. Every box holds an item of the same type, addressed by an offset number called an index.
When to reach for it
Reach for an array when items arrive in a known sequence and need immediate retrieval by position number. Problems asking for running totals, prefix accumulations, cyclic rotations, or in-place rearrangements signal array mechanics. Whenever constraints require constant-time random lookups or contiguous cache scans across fixed collections, a flat sequence is the default container.
How to think about it
Visualize a tape with zero-indexed slots stretching from start to end. Keep track of write and read cursors when modifying contents without allocating helper buffers. For running computations, maintain an invariant such as having processed all elements left of the current index while pending elements wait to the right. When modifying entries in place, consider scanning backwards from the end so unread data is not overwritten.
What each operation costs
| Operation | Time |
|---|---|
| look up element by index | O(1) |
| insert or delete at the start | O(n) |
| search an unsorted collection for a value | O(n) |
What usually goes wrong
- Reading past the final index by checking index less than or equal to length instead of strictly less than length, triggering index out of bounds exceptions.
- Modifying length or removing elements during a forward iteration loop, which causes remaining items to shift left and skip validation on the next neighbor.
- Assuming dynamic resizing is costless inside nested loops, causing repeated memory reallocation copies when appending unknown quantities of items.
Every Arrays problem, easiest first
- Two SumEasy
- Maximum and Minimum Element in an ArrayEasy
- Reverse the ArrayEasy
- Contains DuplicateEasy
- Chocolate Distribution ProblemEasy
- Best Time to Buy and Sell StockEasy
- Merge Sorted ArraysEasy
- Pascal's TriangleEasy
- Majority ElementEasy
- Sort an Array of 0s 1s and 2sEasy
- Leaders in an ArrayEasy
- Check if Array is Sorted and RotatedEasy
- Maximum SubarrayMedium
- Search in Rotated Sorted ArrayMedium
- Repeat and Missing Number ArrayMedium
- Kth Largest Element in an ArrayMedium
- Product of Array Except SelfMedium
- Maximum Product SubarrayMedium
- Find Minimum in Rotated Sorted ArrayMedium
- Find the Duplicate NumberMedium
- Container With Most WaterMedium
- 3SumMedium
- Next PermutationMedium
- Majority Element IIMedium
- Sort ColorsMedium
- Stock Buy and Sell (Multiple Transactions)Medium
- Rotate ArrayMedium
- Find the Missing and Repeating NumberMedium
- Subarray with Given XORMedium
- Longest Subarray with Sum KMedium
- Count Subarrays with Given SumMedium
- Find the Longest Consecutive SequenceMedium
- Rearrange Array Elements by SignMedium
- Trapping Rain WaterHard
Roles that need Arrays
If you are targeting one of these, Arrays sits early in your path rather than being optional.
Track Arrays in your role's order
Pick your target role and all 370 problems resequence to what that interview actually asks. Free.
Start freeArrays interview questions, answered
How many Arrays problems should I solve for interviews?
34 curated Arrays problems cover the patterns interviews repeat: 12 easy, 21 medium and 1 hard. They are drawn from 3 widely used sheets, deduplicated, and ordered easiest first.
Is Arrays actually asked in coding interviews?
Yes, though how much depends on the role. Arrays is a core topic for 25 of the 29 engineering roles tracked here, including SDE / Backend Engineer, Frontend Engineer, Full-Stack Developer. For other roles it is lower frequency and belongs later in a study plan.
Which Arrays problem should I start with?
Start with Two Sum (Easy). The list on this page is ordered easiest first for that reason, so working top to bottom builds the pattern before the harder variations arrive.
Other topics
Problem set and role mapping as of .