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

Algorithm Foundations: Arrays, Searching, Sorting, and Hashing Python lessons

Complexity, linear and binary search, sorted() trade-offs, prefix ideas, two pointers, sliding windows, and hash-map patterns.

19 exercises8+ conceptsBeginner → interview context
Start this topic
WHAT YOU WILL LEARN

Core concepts

Perform linear searchPerform iterative binary searchFind first and last occurrenceSort with bubble sortSort with insertion sortMerge overlapping intervalsBuild product except selfFind the majority element
REUSABLE THINKING

Problem-solving patterns

  • search
  • binary search
  • binary search · boundary
  • bubble sort
  • insertion sort
LESSON OUTCOME

What this topic builds

Learn the idea once, trace it through two verified cases, then explain why your approach works.

ORDERED LESSONS

All 19 lessons in this topic

Work from top to bottom to build each concept gradually.

  1. #091
    Perform linear search

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

    BeginnerPremium
  2. #092
    Perform iterative binary search

    Locate a target in a sorted record list.

    IntermediatePremium
  3. #093
    Find first and last occurrence

    Find the full index range occupied by a repeated target.

    IntermediatePremium
  4. #094
    Sort with bubble sort

    Sort a small list to practice adjacent swaps.

    IntermediatePremium
  5. #095
    Sort with insertion sort

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

    AdvancedPremium
  6. #096
    Merge overlapping intervals

    Merge overlapping meeting time blocks.

    AdvancedPremium
  7. #097
    Build product except self

    For every position, multiply all other values.

    AdvancedPremium
  8. #098
    Find the majority element

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

    Interview-LevelPremium
  9. #099
    Find longest substring without repeats

    Find the longest unique-character window in a common example.

    Interview-LevelPremium
  10. #100
    Maximize one stock transaction

    Find the best profit from exactly one buy followed by one later sale.

    Interview-LevelPremium
  11. #101
    Find unique three-sum triplets

    List all unique triples whose sum is zero.

    Interview-LevelPremium
  12. #102
    Maximize water between lines

    Find the largest container area formed by two vertical lines.

    Interview-LevelPremium
  13. #103
    Calculate trapped rain water

    Calculate total water trapped after rain across varied bars.

    Interview-LevelPremium
  14. #104
    Find the longest consecutive run

    Find the length of the longest consecutive sequence without sorting.

    Interview-LevelPremium
  15. #105
    Rotate a square matrix clockwise

    Rotate a small image matrix 90 degrees clockwise.

    Interview-LevelPremium
  16. #106
    Read a matrix in spiral order

    Return a rectangular matrix in clockwise spiral order.

    Interview-LevelPremium
  17. #107
    Set matrix rows and columns to zero

    Zero the complete row and column containing an original zero.

    Interview-LevelPremium
  18. #108
    Count subarrays with target sum

    Count every contiguous subarray whose sum equals the target.

    Interview-LevelPremium
  19. #109
    Find the minimum covering window

    Find the shortest source substring containing every required character with multiplicity.

    Interview-LevelPremium