Courses

Amazon Coding Interview

Amazon's greatest hits: hashing, two pointers, grids, and binary search on the answer.

Islands
10
Lessons
90
Exercises
311
Complete codeDebugCode orderMultiple choiceTapTrace
  1. Island 1

    Capacity to Ship Packages

    Ship packages in the given order within D days — each day loads consecutive packages up to the boat's capacity. Find the smallest capacity that ships them all in time.

    1. Decode the Problem3 exercises, 5 min
    2. Approach Check4 exercises, 5 min
    3. Build the Brute Force3 exercises, 5 min
    4. Find the Bottleneck2 exercises, 4 min
    5. Discover the Optimal Approach3 exercises, 5 min
    6. Assemble the Algorithm2 exercises, 5 min
    7. Read the Implementation3 exercises, 6 min
    8. Test and Analyze3 exercises, 5 min
    9. Boss BattleBoss8 exercises, 8 min
  2. Island 2

    Number of Islands

    Given a grid of land ('1') and water ('0') cells, count the islands — regions of land connected horizontally or vertically.

    1. Decode the Problem3 exercises, 4 min
    2. Approach Check4 exercises, 4 min
    3. Build the Brute Force3 exercises, 5 min
    4. Find the Bottleneck2 exercises, 4 min
    5. Discover the Optimal Approach3 exercises, 4 min
    6. Assemble the Algorithm2 exercises, 5 min
    7. Read the Implementation3 exercises, 5 min
    8. Test and Analyze3 exercises, 4 min
    9. Boss BattleBoss8 exercises, 8 min
  3. Island 3

    Two Sum

    Find the two numbers in an array that add up to a target, and return their indices.

    1. Decode the Problem3 exercises, 4 min
    2. Approach Check4 exercises, 4 min
    3. Build the Brute Force3 exercises, 5 min
    4. Find the Bottleneck2 exercises, 4 min
    5. Discover the Optimal Approach3 exercises, 4 min
    6. Assemble the Algorithm2 exercises, 5 min
    7. Read the Implementation3 exercises, 5 min
    8. Test and Analyze3 exercises, 4 min
    9. Boss BattleBoss8 exercises, 8 min
  4. Island 4

    Trapping Rain Water

    Bars of varying heights trap rain between them — compute how much water the whole skyline holds.

    1. Decode the Problem3 exercises, 4 min
    2. Approach Check4 exercises, 4 min
    3. Build the Brute Force3 exercises, 5 min
    4. Find the Bottleneck2 exercises, 4 min
    5. Discover the Optimal Approach3 exercises, 4 min
    6. Assemble the Algorithm2 exercises, 5 min
    7. Read the Implementation3 exercises, 5 min
    8. Test and Analyze3 exercises, 4 min
    9. Boss BattleBoss8 exercises, 8 min
  5. Island 5

    Course Schedule

    Given prerequisite pairs, decide whether every course can be finished — or whether the requirements loop forever.

    1. Decode the Problem3 exercises, 4 min
    2. Approach Check4 exercises, 4 min
    3. Build the Brute Force3 exercises, 5 min
    4. Find the Bottleneck2 exercises, 4 min
    5. Discover the Optimal Approach3 exercises, 4 min
    6. Assemble the Algorithm2 exercises, 5 min
    7. Read the Implementation3 exercises, 5 min
    8. Test and Analyze4 exercises, 4 min
    9. Boss BattleBoss8 exercises, 8 min
  6. Island 6

    Rotting Oranges

    Rot spreads from bad oranges to neighbors each minute — find how long until no fresh orange remains, or prove some never rot.

    1. Decode the Problem3 exercises, 4 min
    2. Approach Check4 exercises, 4 min
    3. Build the Brute Force3 exercises, 5 min
    4. Find the Bottleneck2 exercises, 4 min
    5. Discover the Optimal Approach3 exercises, 4 min
    6. Assemble the Algorithm2 exercises, 5 min
    7. Read the Implementation3 exercises, 5 min
    8. Test and Analyze3 exercises, 4 min
    9. Boss BattleBoss8 exercises, 8 min
  7. Island 7

    3Sum

    Find every unique triplet in an array that sums to zero — without listing the same triplet twice.

    1. Decode the Problem3 exercises, 4 min
    2. Approach Check4 exercises, 4 min
    3. Build the Brute Force3 exercises, 5 min
    4. Find the Bottleneck2 exercises, 4 min
    5. Discover the Optimal Approach3 exercises, 4 min
    6. Assemble the Algorithm2 exercises, 5 min
    7. Read the Implementation3 exercises, 5 min
    8. Test and Analyze3 exercises, 4 min
    9. Boss BattleBoss8 exercises, 8 min
  8. Island 8

    Koko Eating Bananas

    Pick the slowest banana-eating speed that still finishes every pile before the guards return in h hours.

    1. Decode the Problem3 exercises, 4 min
    2. Approach Check4 exercises, 4 min
    3. Build the Brute Force3 exercises, 5 min
    4. Find the Bottleneck2 exercises, 4 min
    5. Discover the Optimal Approach3 exercises, 4 min
    6. Assemble the Algorithm2 exercises, 5 min
    7. Read the Implementation3 exercises, 5 min
    8. Test and Analyze3 exercises, 4 min
    9. Boss BattleBoss8 exercises, 8 min
  9. Island 9

    Median of Two Sorted Arrays

    Two sorted arrays, one combined median — find it without actually merging them.

    1. Decode the Problem3 exercises, 4 min
    2. Approach Check4 exercises, 4 min
    3. Build the Brute Force3 exercises, 5 min
    4. Find the Bottleneck2 exercises, 4 min
    5. Discover the Optimal Approach3 exercises, 4 min
    6. Assemble the Algorithm2 exercises, 5 min
    7. Read the Implementation3 exercises, 5 min
    8. Test and Analyze3 exercises, 4 min
    9. Boss BattleBoss8 exercises, 8 min
  10. Island 10

    Longest Repeating Character Replacement

    You may repaint at most k letters — find the longest stretch you can turn into one repeated character.

    1. Decode the Problem3 exercises, 4 min
    2. Approach Check4 exercises, 4 min
    3. Build the Brute Force3 exercises, 5 min
    4. Find the Bottleneck2 exercises, 4 min
    5. Discover the Optimal Approach3 exercises, 4 min
    6. Assemble the Algorithm2 exercises, 5 min
    7. Read the Implementation3 exercises, 5 min
    8. Test and Analyze3 exercises, 4 min
    9. Boss BattleBoss8 exercises, 8 min
AlgoFox Pro

Amazon Coding Interview is part of AlgoFox Pro

You can read the whole course outline here. The exercises are in the app, along with your streak, your mistake review, and the progress that carries across your devices.

Pro starts with a 3 day free trial. The app store decides who is eligible for an introductory offer, and a lapsed subscription does not get another one.

Download AlgoFox on the App StoreGet AlgoFox on Google Play

Already subscribed in the app? Sign in with the same account and Pro works here too. Quick Play and Battle are free on the web, and so is the first course in every subject.