Skip to main content

Apple Coding Interview Questions

32 Apple coding interview problems with full optimal solutions — 11 easy, 19 medium, 2 hard. Every problem ships with multiple approaches (brute-force first, then the optimal), complexity tables for each, company-specific tips on what an Apple interviewer values, and a FAQ section.

Showing 19 problems of 32

  • #25mediumfoundational

    25. Find Minimum in Rotated Sorted Array

    Find the minimum element in a rotated sorted array in O(log n) — Apple asks this to test whether you can adapt binary search when invariants are partially broken, a skill directly applicable to finding pivot points in macOS system log timestamps.

  • #26mediumfoundational

    26. Number of Islands

    Count connected land regions in a binary grid using BFS/DFS — Apple applies this grid-traversal pattern to UI layout engines that must identify distinct content regions on a display, and to Maps clustering connected geographic tiles.

  • #27mediumfoundational

    27. Course Schedule

    Detect circular dependencies in a directed graph — Apple's Xcode build system and Swift Package Manager use topological sort to resolve framework dependency graphs; cycle detection is the first thing that must work correctly before any build starts.

  • #28mediumfoundational

    28. Validate Binary Search Tree

    Verify that every node in a binary tree satisfies the full BST invariant — Apple's file system and UI accessibility tree code depends on validated sorted structures, making this a core screening question for roles touching CoreData or UIAccessibility.

  • #29mediumfoundational

    29. Decode Ways

    Count all valid decodings of a digit string where 1-26 map to A-Z — Apple uses this DP pattern to evaluate how engineers reason about combinatorial text-parsing states, directly analogous to the multi-codepoint emoji rendering decisions in iMessage.

  • #30mediumfoundational

    30. Rotate Image

    Rotate an n×n matrix 90 degrees clockwise in-place — Apple's AVFoundation and Photos frameworks rotate CVPixelBuffer image data without allocating extra memory on memory-constrained iPhones, making this in-place matrix transformation a consistent favorite for Camera and Vision team interviews.

  • #31mediumfoundational

    31. Kth Largest Element in an Array

    Find the kth largest element without full sorting — Apple Fitness+ and HealthKit stream millions of events and must surface top-k rankings in real time; this heap/quickselect problem is a direct analog of that competitive-leaderboard challenge.

  • #2mediumfrequently asked

    2. Add Two Numbers

    Add Two Numbers is Apple's linked-list-as-digits arithmetic question. Walk both lists in parallel, adding digit + digit + carry, allocate a new node per output digit, and handle different lengths and a possible trailing carry. The dummy-head trick keeps the code tidy.

    4 free resourcesSolve →
  • #3mediumfoundational

    3. Longest Substring Without Repeating Characters

    Longest Substring Without Repeating Characters is the canonical sliding-window question and Apple's most-repeated string medium. Expand the right pointer; when a duplicate appears, jump the left pointer to last_index_of_dup + 1. The hash-map-of-char-to-last-index variant is what Apple grades on.

    4 free resourcesSolve →
  • #7mediumfrequently asked

    7. Reverse Integer

    Reverse Integer is Apple's deceptively-simple overflow-detection question. The reversal loop is three lines; the real challenge is detecting 32-bit overflow BEFORE it happens. Apple grades on whether you remember -2^31 to 2^31 - 1 and check the bound on every digit append.

    4 free resourcesSolve →
  • #8mediumfrequently asked

    8. String to Integer (atoi)

    String to Integer (atoi) is Apple's adversarial parsing question. Six precise rules — skip whitespace, read optional sign, read digits, clamp to 32-bit — and you must handle every weird input the interviewer throws at you. Apple grades on edge-case coverage, not on the parse loop itself.

    4 free resourcesSolve →
  • #15mediumfrequently asked

    15. 3Sum

    3Sum is Apple's introduction to fix-one-then-two-pointer pattern. Sort the array, fix nums[i] as the anchor, then run a two-pointer sweep for the other two values that sum to -nums[i]. The duplicate-skipping is the bug surface Apple specifically grades on.

    4 free resourcesSolve →
  • #102mediumfrequently asked

    102. Binary Tree Level Order Traversal

    Binary Tree Level Order Traversal is Apple's canonical BFS-on-a-tree question. Process the queue one level at a time by snapshotting its size at the start of each iteration. Apple grades on whether you remember the size snapshot — most candidates accidentally bleed levels together.

    4 free resourcesSolve →
  • #146mediumfrequently asked

    146. LRU Cache

    LRU Cache is Apple's flagship data-structure design medium. The answer is a hash map for O(1) lookup plus a doubly linked list for O(1) move-to-front. Apple specifically grades on whether you handle the pointer surgery without leaving a dangling neighbor.

    4 free resourcesSolve →
  • #198mediumfrequently asked

    198. House Robber

    House Robber is Apple's clean 1D DP medium. dp[i] = max(dp[i-1], dp[i-2] + nums[i]) — either skip this house or take it plus the best up to two back. Apple grades on whether you can derive that recurrence on the spot and reduce to O(1) space.

    4 free resourcesSolve →
  • #211mediumfrequently asked

    211. Design Add and Search Words Data Structure

    Design Add and Search Words Data Structure is Apple's go-to trie design medium. Add inserts a word normally; search supports '.' as a wildcard that matches any single character. The wildcard turns the search into a tiny DFS down every matching child node.

    4 free resourcesSolve →
  • #236mediumfrequently asked

    236. Lowest Common Ancestor of a Binary Tree

    Lowest Common Ancestor is Apple's elegant tree recursion medium. The clean answer is dual: 'return p or q if found, else return whichever subtree returned non-null — if both subtrees return non-null, this node is the LCA.' Five lines that make Apple interviewers smile.

    4 free resourcesSolve →
  • #238mediumfrequently asked

    238. Product of Array Except Self

    Product of Array Except Self is Apple's beloved 'no division' question. Two passes — left-products then right-products into the same output array — gives O(n) time with O(1) extra space. Apple grades on whether you avoid division entirely and handle the multi-zero case.

    4 free resourcesSolve →
  • #322mediumfrequently asked

    322. Coin Change

    Coin Change is Apple's go-to unbounded-knapsack DP medium. dp[i] = min coins to make amount i. For each i, try every coin and take the minimum. Apple is grading whether you can write the recurrence AND explain why the greedy (take the largest coin) does not work on arbitrary denominations.

    4 free resourcesSolve →

Related interview-prep guides

Interview Platforms

HireVue Tech Interview Guide: The 2026 Playbook for Async Video Rounds

HireVue is the category-leading async video interview platform. Candidates record answers solo, on the clock, and a combined AI-plus-human review layer scores the recording days later. For 2026 tech jobseekers, the format is different enough from live interviews to need its own playbook. This guide is that playbook.

Interview Platforms

LeetCode Assessments: The 2026 Tech Interview Guide

LeetCode Assessments is the enterprise tier of the LeetCode platform: a separate product from the public site candidates know from grinding problems. Companies pay LeetCode to build custom timed assessments that draw from the 3,000-problem public catalog plus optional private variations, and the catalog asymmetry is the whole story for prep.

Interview Platforms

Zoom Tech Interview Guide 2026: How the Platform Works for Engineering Hiring

Zoom is the most-deployed video meeting software in US tech hiring. It is the default from one-person startups to Fortune 100 engineering orgs. It is general-purpose meeting software, not an anti-cheating platform. This guide covers what Zoom sees during a tech interview, the screen-share modes hiring teams use, the OS-level boundary the platform cannot cross, and how a modern desktop interview assistant pairs with the standard Zoom tech-interview flow.

Apple Coding Interview Questions — Full Solutions — InterviewChamp.AI