pyPython Practice LabFrom first print to final round
TOPIC 11 OF 18

Searching, Sorting, and Array Interviews Python practice problems

Practice the array, searching, sorting, interval, and hashing questions asked in interviews.

20 exercises8+ conceptsBeginner → interview context
Start this topic
WHAT YOU WILL PRACTISE

Core concepts

Perform linear searchPerform iterative binary searchFind first and last occurrenceSort with bubble sortSort with insertion sortSort with merge sortSort with quicksortMerge overlapping intervals
REUSABLE THINKING

Problem-solving patterns

  • Recognize the array pattern → define the invariant → scan efficiently
INTERVIEW SIGNALS

Reported company tags

AmazonMicrosoftGoogle
Community-reported tags are guidance, not guarantees.
ORDERED PRACTICE

All 20 problems in this topic

Work from top to bottom to build the concept gradually.

  1. #201
    Perform linear search: Find inventory code

    Locate the first occurrence of a code in an unsorted list.

    InterviewPremium
  2. #202
    Perform linear search: Target missing

    Return -1 after checking the complete list.

    InterviewPremium
  3. #203
    Perform iterative binary search: Find sorted record

    Locate a target in a sorted record list.

    InterviewPremium
  4. #204
    Perform iterative binary search: Outside the range

    Return -1 when a target is larger than every element.

    InterviewPremium
  5. #205
    Find first and last occurrence: Repeated target range

    Find the full index range occupied by a repeated target.

    InterviewPremium
  6. #206
    Find first and last occurrence: Single occurrence

    Both boundaries are identical when the target appears once.

    InterviewPremium
  7. #207
    Sort with bubble sort: Unsorted readings

    Sort a small list to practice adjacent swaps.

    InterviewPremium
  8. #208
    Sort with bubble sort: Already sorted

    Exercise the early-exit optimization on sorted input.

    InterviewPremium
  9. #209
    Sort with insertion sort: Nearly sorted scores

    Sort a nearly ordered list, a good case for insertion sort.

    InterviewPremium
  10. #210
    Sort with insertion sort: Reverse order

    Exercise the maximum number of shifts for a short list.

    InterviewPremium
  11. #211
    Sort with merge sort: General list

    Apply a stable divide-and-conquer sort to mixed integers.

    InterviewPremium
  12. #212
    Sort with merge sort: Duplicates and negatives

    Preserve duplicates while ordering signed values.

    InterviewPremium
  13. #213
    Sort with quicksort: Quicksort practice

    Sort a general list using recursive partitioning.

    InterviewPremium
  14. #214
    Sort with quicksort: Many duplicate pivots

    Use the equal partition to group repeated values efficiently.

    InterviewPremium
  15. #215
    Merge overlapping intervals: Meeting blocks

    Merge overlapping meeting time blocks.

    InterviewPremium
  16. #216
    Merge overlapping intervals: Touching intervals

    Treat intervals that meet at an endpoint as one continuous interval.

    InterviewPremium
  17. #217
    Build product except self: Positive array

    For every position, multiply all other values.

    InterviewPremium
  18. #218
    Build product except self: One zero

    A zero leaves only its own position with a nonzero product.

    InterviewPremium
  19. #219
    Find the majority element: Clear majority

    Find the value occurring in more than half of the list.

    InterviewPremium
  20. #220
    Find the majority element: Short majority

    Handle the smallest list with a repeated majority.

    InterviewPremium