Courses
Apple Coding Interview
Apple's staples: intervals, an LRU cache, prefix sums, and rebuilding trees from traversals.
- Islands
- 8
- Lessons
- 72
- Exercises
- 249
Complete codeDebugCode orderMultiple choiceTapTrace
Island 1Turn a singly linked list around so every arrow points the other way.
- Decode the Problem3 exercises, 4 min
- Approach Check4 exercises, 4 min
- Build the Brute Force3 exercises, 5 min
- Find the Bottleneck2 exercises, 4 min
- Discover the Optimal Approach3 exercises, 4 min
- Assemble the Algorithm2 exercises, 5 min
- Read the Implementation3 exercises, 5 min
- Test and Analyze3 exercises, 4 min
- Boss BattleBoss8 exercises, 8 min
Island 2Pick one day to buy and a later day to sell for the biggest possible profit.
- Decode the Problem3 exercises, 4 min
- Approach Check4 exercises, 4 min
- Build the Brute Force3 exercises, 5 min
- Find the Bottleneck2 exercises, 4 min
- Discover the Optimal Approach3 exercises, 4 min
- Assemble the Algorithm2 exercises, 5 min
- Read the Implementation3 exercises, 5 min
- Test and Analyze3 exercises, 4 min
- Boss BattleBoss8 exercises, 8 min
Island 3Collapse a list of possibly-overlapping intervals into the fewest non-overlapping ones.
- Decode the Problem3 exercises, 4 min
- Approach Check4 exercises, 4 min
- Build the Brute Force3 exercises, 5 min
- Find the Bottleneck2 exercises, 4 min
- Discover the Optimal Approach3 exercises, 4 min
- Assemble the Algorithm2 exercises, 5 min
- Read the Implementation3 exercises, 5 min
- Test and Analyze3 exercises, 4 min
- Boss BattleBoss8 exercises, 8 min
Island 4Sum the bit-differences over every pair of numbers in the array — without checking every pair.
- Decode the Problem3 exercises, 4 min
- Approach Check4 exercises, 4 min
- Build the Brute Force3 exercises, 5 min
- Find the Bottleneck2 exercises, 4 min
- Discover the Optimal Approach3 exercises, 4 min
- Assemble the Algorithm2 exercises, 5 min
- Read the Implementation3 exercises, 5 min
- Test and Analyze3 exercises, 4 min
- Boss BattleBoss8 exercises, 8 min
Island 5Count how many contiguous stretches of an array sum to exactly k.
- Decode the Problem3 exercises, 4 min
- Approach Check4 exercises, 4 min
- Build the Brute Force3 exercises, 5 min
- Find the Bottleneck2 exercises, 4 min
- Discover the Optimal Approach3 exercises, 4 min
- Assemble the Algorithm2 exercises, 5 min
- Read the Implementation3 exercises, 5 min
- Test and Analyze3 exercises, 4 min
- Boss BattleBoss8 exercises, 8 min
Island 6Produce an actual order to take every course given its prerequisites — or report that none exists.
- Decode the Problem3 exercises, 4 min
- Approach Check4 exercises, 4 min
- Build the Brute Force3 exercises, 5 min
- Find the Bottleneck2 exercises, 4 min
- Discover the Optimal Approach3 exercises, 4 min
- Assemble the Algorithm2 exercises, 5 min
- Read the Implementation3 exercises, 5 min
- Test and Analyze4 exercises, 4 min
- Boss BattleBoss8 exercises, 8 min
Island 7Rebuild a binary tree knowing only the order its nodes were visited — twice, differently.
- Decode the Problem3 exercises, 4 min
- Approach Check4 exercises, 4 min
- Build the Brute Force3 exercises, 5 min
- Find the Bottleneck2 exercises, 4 min
- Discover the Optimal Approach3 exercises, 4 min
- Assemble the Algorithm2 exercises, 5 min
- Read the Implementation3 exercises, 5 min
- Test and Analyze3 exercises, 4 min
- Boss BattleBoss8 exercises, 8 min
Island 8Design a fixed-size cache where get and put run in constant time and the least recently used entry is evicted first.
- Decode the Problem3 exercises, 4 min
- Approach Check4 exercises, 4 min
- Build the Brute Force3 exercises, 5 min
- Find the Bottleneck2 exercises, 4 min
- Discover the Optimal Approach3 exercises, 4 min
- Assemble the Algorithm2 exercises, 5 min
- Read the Implementation3 exercises, 5 min
- Test and Analyze3 exercises, 4 min
- Boss BattleBoss8 exercises, 8 min