Searching, Sorting, and Array Interviews Python practice problems
Practice the array, searching, sorting, interval, and hashing questions asked in interviews.
Core concepts
Problem-solving patterns
- Recognize the array pattern → define the invariant → scan efficiently
Reported company tags
All 20 problems in this topic
Work from top to bottom to build the concept gradually.
- #201Perform linear search: Find inventory codeInterviewPremium
Locate the first occurrence of a code in an unsorted list.
- #202Perform linear search: Target missingInterviewPremium
Return -1 after checking the complete list.
- #203Perform iterative binary search: Find sorted recordInterviewPremium
Locate a target in a sorted record list.
- #204Perform iterative binary search: Outside the rangeInterviewPremium
Return -1 when a target is larger than every element.
- #205Find first and last occurrence: Repeated target rangeInterviewPremium
Find the full index range occupied by a repeated target.
- #206Find first and last occurrence: Single occurrenceInterviewPremium
Both boundaries are identical when the target appears once.
- #207Sort with bubble sort: Unsorted readingsInterviewPremium
Sort a small list to practice adjacent swaps.
- #208Sort with bubble sort: Already sortedInterviewPremium
Exercise the early-exit optimization on sorted input.
- #209Sort with insertion sort: Nearly sorted scoresInterviewPremium
Sort a nearly ordered list, a good case for insertion sort.
- #210Sort with insertion sort: Reverse orderInterviewPremium
Exercise the maximum number of shifts for a short list.
- #211Sort with merge sort: General listInterviewPremium
Apply a stable divide-and-conquer sort to mixed integers.
- #212Sort with merge sort: Duplicates and negativesInterviewPremium
Preserve duplicates while ordering signed values.
- #213Sort with quicksort: Quicksort practiceInterviewPremium
Sort a general list using recursive partitioning.
- #214Sort with quicksort: Many duplicate pivotsInterviewPremium
Use the equal partition to group repeated values efficiently.
- #215Merge overlapping intervals: Meeting blocksInterviewPremium
Merge overlapping meeting time blocks.
- #216Merge overlapping intervals: Touching intervalsInterviewPremium
Treat intervals that meet at an endpoint as one continuous interval.
- #217Build product except self: Positive arrayInterviewPremium
For every position, multiply all other values.
- #218Build product except self: One zeroInterviewPremium
A zero leaves only its own position with a nonzero product.
- #219Find the majority element: Clear majorityInterviewPremium
Find the value occurring in more than half of the list.
- #220Find the majority element: Short majorityInterviewPremium
Handle the smallest list with a repeated majority.