Apple interview coding questions range from medium to high difficulty. The primary questions in Apple’s coding interviews include dynamic programming, graph algorithms, and problems related to trees and linked lists.
Top 30 Apple coding interview questions (with solutions)
Working at Apple is a dream for many developers, but preparing for coding interviews is no easy task.
We start with an overview of the interview process for software engineering and then break down the top Apple interview questions with in-depth code solutions and complexity measures. We’ll offer our solutions in C++.
Apple software engineer interview process overview#
Apple’s software engineer interview process differs from other larger tech companies, like Amazon, due to the number of interviews they hold and their on-site process.
If you are asked to interview at Apple, the process generally looks like this:
-
Prescreen with Recruiter: It will take about a week from resume submission to first contact. A recruiter will usually reach out over LinkedIn or email to set up a time for a phone call. This phone screen will last from 15-30 minutes, and the questions will not be overly technical. You could expect questions like Why do you want to work for Apple? or What’s your favorite Apple product or service?
-
Technical phone interview: Usually a week later, they will schedule your next technical phone interview. There will be one or two technical phone screens with questions about your resume and a coding question on data structures and algorithms. The coding interviews are about 45-60 minutes, with 30 minutes to complete the challenge.
-
On-site interview: The onsite interview will last about 6 hours. You’ll meet with 8-12 Apple employees, and interviews will be a mix of behavioral, domain knowledge, and coding challenges. Each interview is about 45 minutes to an hour where you will be posed with technical problems. Behavioral questions are also very important for hiring managers.
Data structures you should know: Arrays, Linked Lists, Stacks, Queues, Trees, Graphs, Heaps, Hash sets, Hash maps
Algorithms you should know: Depth first search, Breadth first search, Binary search, Quicksort, Mergesort, Dynamic programming, Divide and conquer
Answer any interview problem by learning the patterns behind common questions.#
Apple coding interview roadmap: Beginner to advanced#
Preparing for Apple coding interviews can feel overwhelming because there are so many potential topics to cover. Arrays, strings, trees, graphs, dynamic programming, and System Design can all appear in the interview process depending on the role and level you're targeting.
Rather than treating every problem equally, it's helpful to think about interview preparation as a progression. Apple interviewers typically start by evaluating your problem-solving fundamentals before moving into more complex algorithmic challenges and system-level discussions.
This roadmap organizes common Apple coding interview questions by difficulty level so you can prioritize your preparation and build confidence systematically.
Difficulty overview#
Difficulty | Typical Apple Round | Topics | Target Time |
Beginner | Early phone screen | Arrays, strings, hash maps | 15–20 min |
Intermediate | Technical interview | Trees, graphs, linked lists | 20–30 min |
Advanced | Senior interviews/on-site | Dynamic programming, system design, optimization | 30–45 min |
Beginner Apple interview questions#
At this stage, Apple is evaluating whether you can apply fundamental data structures and algorithmic patterns efficiently. These questions typically focus on arrays, strings, sorting, searching, and hash maps.
Reverse words in a sentence#
Difficulty: Beginner
Key pattern: String manipulation
Why Apple asks it: Tests basic string processing, edge cases, and clean code implementation.
Preparation priority: High
This type of question evaluates your ability to manipulate data structures efficiently without relying heavily on built-in shortcuts.
Determine sum of three integers#
Difficulty: Beginner
Key pattern: Two pointers, sorting
Why Apple asks it: Introduces candidates to optimization beyond brute force solutions.
Preparation priority: High
Interviewers often look for whether you can improve an O(n³) solution to O(n²).
Merge overlapping intervals#
Difficulty: Beginner
Key pattern: Sorting and interval processing
Why Apple asks it: Tests practical problem-solving and handling of real-world data ranges.
Preparation priority: High
This problem appears frequently across FAANG interviews because it combines sorting and careful iteration.
Search in rotated array#
Difficulty: Beginner
Key pattern: Modified binary search
Why Apple asks it: Evaluates understanding of search algorithms and edge cases.
Preparation priority: Medium–High
Candidates are expected to recognize that binary search can still be applied even when data is partially rotated.
Largest sum subarray#
Difficulty: Beginner
Key pattern: Kadane's Algorithm
Why Apple asks it: Measures understanding of optimization and dynamic programming fundamentals.
Preparation priority: High
This is one of the most important array problems for interview preparation.
Intermediate Apple interview questions#
Intermediate questions move beyond basic data structures and require deeper reasoning about relationships between nodes, pointers, and recursive structures.
Add two integers represented by linked lists#
Difficulty: Intermediate
Key pattern: Linked list manipulation
Interview focus: Pointer handling, carry propagation, and clean implementation.
This problem frequently appears because it combines linked list traversal with arithmetic logic.
Merge two sorted linked lists#
Difficulty: Intermediate
Key pattern: Linked list merging
Interview focus: Pointer manipulation and iterative reasoning.
Interviewers often ask follow-up questions about recursive solutions and space complexity.
Clone a directed graph#
Difficulty: Intermediate
Key pattern: Graph traversal (DFS/BFS)
Interview focus: Graph modeling and cycle handling.
This problem tests whether candidates understand how to duplicate complex structures safely.
Determine if two binary trees are identical#
Difficulty: Intermediate
Key pattern: Tree recursion
Interview focus: Recursive thinking and traversal strategies.
This question often serves as a foundation for more advanced tree-related discussions.
Mirror binary tree#
Difficulty: Intermediate
Key pattern: Recursive tree transformation
Interview focus: Tree manipulation and recursion depth.
Apple interviewers frequently use tree questions to evaluate structured problem-solving.
Advanced Apple interview questions#
Advanced questions focus on optimization, scalability, algorithmic depth, and engineering judgment. These problems typically appear during later interview rounds and senior-level interviews.
Implement LRU Cache#
Difficulty: Advanced
Core concepts tested:
Hash maps
Doubly linked lists
O(1) operations
Data structure design
Common follow-up questions:
Thread safety
Memory constraints
Distributed caching
This is one of the most frequently asked advanced design-oriented coding problems.
Dynamic programming challenges#
Difficulty: Advanced
Core concepts tested:
State transitions
Memoization
Tabulation
Optimization
Common follow-up questions:
Space optimization
Alternative formulations
Time complexity improvements
Dynamic programming often separates strong candidates from average ones.
Complex graph problems#
Difficulty: Advanced
Core concepts tested:
Shortest paths
Topological sorting
Connectivity
Cycle detection
Common follow-up questions:
Scalability
Large graph handling
Distributed graph processing
These questions assess algorithmic maturity and abstraction skills.
Large-scale optimization questions#
Difficulty: Advanced
Core concepts tested:
Greedy algorithms
Heuristics
Performance trade-offs
Common follow-up questions:
Real-world constraints
Resource limitations
Production considerations
Interviewers often care more about reasoning than the final answer.
Design-oriented coding problems#
Difficulty: Advanced
Core concepts tested:
API design
Object-oriented design
Extensibility
Maintainability
Common follow-up questions:
Future scalability
System evolution
Design trade-offs
These questions are particularly common for experienced engineers.
Recommended study sequence#
A structured preparation plan is usually more effective than randomly solving problems.
Week 1: Arrays and strings#
Focus on:
Sliding window
Two pointers
Hash maps
String manipulation
Goal: Build confidence with common interview patterns.
Week 2: Linked lists and hash maps#
Focus on:
Pointer manipulation
Fast and slow pointers
Linked list traversal
Hash-based optimization
Goal: Become comfortable with reference-based data structures.
Week 3: Trees and graphs#
Focus on:
DFS
BFS
Recursive traversal
Graph modeling
Goal: Develop recursive and graph reasoning skills.
Week 4: Dynamic programming#
Focus on:
Memoization
Tabulation
Pattern recognition
Goal: Learn to solve optimization problems systematically.
Week 5: System Design and advanced topics#
Focus on:
LRU Cache
Design-oriented questions
Scalability discussions
Architecture fundamentals
Goal: Prepare for senior-level discussions and onsite interviews.
What difficulty level should you target?#
Your preparation strategy should match your experience level.
New graduates#
Focus heavily on Beginner and Intermediate questions.
Most entry-level Apple interviews emphasize coding fundamentals, clean problem-solving, and communication.
Mid-level engineers#
Master Intermediate questions and become comfortable with selected Advanced topics.
You should expect deeper discussions around trade-offs and optimization.
Senior engineers#
Expect Advanced questions, architecture discussions, and System Design interviews.
Strong engineering judgment often matters as much as algorithmic knowledge.
Visual progression#
Beginner↓Intermediate↓Advanced↓Apple On-Site Success
The goal is not to rush toward advanced topics. Each level builds skills that make the next level easier to master.
Preparation timeline#
If you're preparing specifically for Apple interviews, a reasonable timeline looks like this:
2–3 weeks | Beginner fundamentals |
4–6 weeks | Beginner + Intermediate |
6–10 weeks | Intermediate mastery |
10+ weeks | Advanced coding and System Design |
Consistency is more important than solving hundreds of random problems.
Most successful Apple candidates master the fundamentals before tackling advanced algorithmic challenges. Strong performance on arrays, strings, linked lists, trees, and graphs creates the foundation needed for dynamic programming, optimization, and design-oriented questions.
Remember that Apple interviewers are evaluating more than correctness. They care about how you communicate, reason through trade-offs, handle feedback, and approach unfamiliar problems.
Arrays and graphs questions#
Determine sum of three integers#
The goal of this exercise is to determine if the sum of three integers is equal to the given value.
Problem statement: Given an array of integers and a value, determine if there are any three integers in the array whose sum equals the given value.
Consider this array and the target sums.
Try it yourself below before checking the solution.
In this solution, we sort the array. Then, fix one element e and find a pair (a, b) in the remaining array so that required_sum - e is a + b.
Start with first element e in the array and try to find such a pair (a, b) in the remaining array (i.e A[i + 1] to A[n - 1]) that satisfies the condition: a+b = required_sum - e. If we find the pair, we have found the solution: a, b and e. Now we can stop the iteration.
Otherwise, we repeat the above steps for all elements e at index i = 1 to n - 3 until we find a pair that meets the condition.
Runtime Complexity: Quadratic,
Memory Complexity: Constant,
Merge overlapping intervals#
The goal of this exercise is to merge all the overlapping intervals of a given list to produce a list that has only mutually exclusive intervals.
Problem statement: You have an array (list) of interval pairs as input where each interval has a start and end timestamp, sorted by starting timestamps. Merge the overlapping intervals and return a new output array.
Consider an input array below. Intervals (1, 5), (3, 7), (4, 6), (6, 8) are overlapping so they should be merged to one interval (1, 8). Similarly, intervals (10, 12) and (12, 15) are also overlapping and should be merged to (10, 15).
Try it yourself below before checking the solution.
This problem can be solved with a linear scan algorithm. The list of input intervals is given, and we’ll keep merged intervals in the output list. For each interval in the input list:
- If the input interval is overlapping with the last interval in the output list, merge these two intervals and update the last interval of the output list with the merged interval.
- Otherwise, add an input interval to the output list.
Runtime complexity: Linear,
Memory complexity: Linear,
Clone a Directed Graph#
The goal of this exercise is to clone a directed graph and print an output graph using hash table and depth first traversal.
Problem statement: Given the root node of a directed graph, clone the graph by creating a deep copy. The cloned graph will have the same vertices and edges.
Try to solve it yourself below before checking the solution.
We use depth first traversal and create a copy of each node while traversing the graph. Use a hashtable to store each completed node so we won’t revisit nodes that exist in that hashtable. The hashtable key will be a node in the original graph, and its value will be the corresponding node in the cloned graph.
Runtime Complexity: Linear,
Memory Complexity: Logarithmic, , where is the number of vertices in the graph.
Working at Apple is a dream for many software engineers. Their rigorous interview process requires careful preparation and a strategic approach. That’s why we’ve handpicked the top 50 Apple coding interview questions for you. Master the underlying patterns behind these questions. In the process, learn the game-changing skill of unpacking and answering thousands of LeetCode-style questions the right way just by assessing the problem statement. This approach was created by MAANG hiring managers to help you prepare for the typical rounds of interviews at major tech companies like Apple. This condensed set of coding interview questions ensures the coverage of essential coding patterns to give you the confidence needed to ace your coding interviews at Apple without endless problem-solving. Each module in the path presents a set of related coding patterns to help you prepare in a focused, methodical manner. This path is also available in Python, JavaScript, C++, and Java with more coming soon!
Linked Lists questions#
Add two integers#
The goal of this exercise is to add two integers of two linked lists.
Problem statement: You are given the head pointers of two linked lists where each linked list represents an integer number (i.e. each node is a digit). Add them and return the new linked list.
Try it yourself below before checking the solution.
To understand this better, let’s consider an example. Say we want to add the integers 9901 and 237. The result of this addition would be 10138.
The integers are stored inverted in the linked lists to make this easier. The most significant digit of the number is the last element of the linked list. To start adding, we start from the heads of the two linked lists.
At each iteration, we add the current digits of the two lists and insert a new node with the resulting digit at the tail of the result linked list. We’ll also need to maintain carry for each step.
We do this for all digits in both the linked lists. If one of the linked lists ends sooner, we’ll continue with the other linked list. Once both of the linked lists are done and no carry is left to be added, the algorithm will terminate.
Runtime Complexity: Linear,
Memory Complexity: Linear,
Enjoying the article? Scroll down to sign up for our free, bi-monthly newsletter.
Merge two sorted linked lists#
The goal of this exercise is to merge two sorted linked lists.
Problem statement: Given two sorted linked lists, merge them so the resulting linked list is also sorted.
Try it yourself below before checking the solution.
Maintain a head and a tail pointer on the merged linked list. Choose the head of the merged linked list by comparing the first node of both linked lists.
For all subsequent nodes, choose the smaller current node and link it to the tail of the merged list. Move the current pointer of that list one step forward.
If there are still some elements in only one of the lists, link this remaining list to the tail of the merged list. Initially, the merged linked list is NULL.
Compare the value of the first two nodes and make the node with the smaller value the head node of the merged linked list. In this example, it is 4 from head1. Since it’s the first and only node in the merged list, it will be the tail. Then move head1 one step forward.
Runtime Complexity: Linear, , where and are lengths of our linked lists
Memory Complexity: Constant,
Trees questions#
Determine if two binary trees are identical#
The goal of this exercise is to compare two binary trees to determine if they are identical or not.
Problem statement: You are given the roots of two binary trees and must determine if these trees are identical. Identical trees have the same layout and data at each node.
Tip: Trees that have the same data aren’t necessarily identical. What’s important is their structure.
Try it yourself below before checking the solution.
This problem can be solved recursively. The base case of recursion for this solution is if two compared nodes are null or one of them is null.
Two trees A and B are identical if:
- Data on their roots is the same or both roots are null
- The left subtree of
Ais identical to the left sub-tree ofB - The right subtree of
Ais identical to the right subtree ofB
Use a depth-first traversal on both trees simultaneously and keep comparing the data at each level to solve this problem.
Runtime Complexity: Linear,
Memory Complexity: in best case, or it will be for a balanced tree and in the worst case can be .
Mirror binary tree nodes#
The goal of this exercise is to use depth first traversal and bottom up mirroring to mirror the nodes of a binary tree.
Problem statement: You are given the root node of a binary tree and must swap the left and right children for each node.
Try it yourself below before checking the solution.
We do a post order traversal of the binary tree. For every node, swap its left child with its right child. We use DFS on the tree, so that before returning from a node, all its children have been visited (and mirrored).
Runtime complexity: Linear,
Memory Complexity: Linear, in the worst case
Strings questions#
Find all palindrome substrings#
The goal of this exercise is to find the palindrome substrings of a given string.
Problem statement: Given a string, find all non-single letter substrings that are palindromes. The string given is "aabbbaa".
Try it yourself below before checking the solution.
For each letter in the input string, start expanding to the left and right while checking for even and odd length palindromes. Move to the next letter if we know a palindrome doesn’t exist there.
We expand one character to the left and right and compare. If both are equal, we print out the palindrome substring.
Runtime complexity: Polynomial,
Memory complexity: Constant,
Reverse words in a sentence#
The goal of this exercise is to reverse the words in a given string. Be sure to note how the words are separated by whitespaces.
Problem statement: Reverse the order of words in a given sentence (an array of characters). The words given are "Hello World!".
Try it yourself below before checking the solution.
There are two steps to this problem. First, reverse the string. Then, traverse the string and reverse each word in place.
Runtime complexity: Linear,
Memory complexity: Constant,
Answer any interview problem by learning the patterns behind common questions.#
Dynamic programming questions#
Largest Sum Subarray#
The goal of this exercise is to use your dynamic programming skills and Kadane’s algorithm to find the largest sum subarray.
Problem statement: Find the largest sum subarray. In the array below, the largest sum subarray starts at index 3 and ends at 6, and with the largest sum being 12.
Try it yourself below before checking the solution.
We use Kadane’s algorithm to solve this. The basic idea of this algorithm is to scan the entire array and at each position find the maximum sum of the subarray ending there. This is achieved by keeping a current_max for the current array index and a global_max.
The algorithm is as follows:
current_max = A[0]
global_max = A[0]
for i = 1 -> size of A
if current_max is less than 0
then current_max = A[i]
otherwise
current_max = current_max + A[i]
if global_max is less than current_max
then global_max = current_max
Runtime complexity: Linear,
Memory complexity: Constant,
Math and stats#
Power of a number#
The goal of this exercise is to use divide and conquer and write a function that calculates the raised to the power of a number.
Problem statement: You are given a double, x and an integer n, write a function to calculate x raised to the power n.
Try it yourself below before checking the solution.
We can use the divide and conquer approach to solve this problem most efficiently. In the dividing step, we keep dividing n by 2 recursively until we reach the base case.
In the combining step, we get the result r of the sub-problem and compute the result of the current problem using the two rules below:
- If
nis even, the result isr * r(whereris the result of sub-problem) - If
nis odd, the result isx * r * r(whereris the result of sub-problem)
Runtime Complexity: Logarithmic,
Memory Complexity: Logarithmic,
We recursively go through all possible sum combinations, and when the running sum equals the target, print that combination.
The algorithm will recursively check all the numbers that can sum up to the target.
In each recursive call, there is a for loop that runs from start to target, where start is initially 1. current_sum is the variable that is incremented with every recursive call.
Every time a value is added to the current_sum, it is also added to the result list. Whenever current_sum equals target, we know that the result list contains a possible combination for target, and this list is then appended to the final output list.
Base condition of recursion:
if current_sum equals target
print the output contents
Before each recursive call, an element is added to result. However, after each call, this element is also removed from the list to reset the list.
Runtime Complexity: Exponential,
Memory Complexity: Linear,
Searching and design questions#
Search in rotated array#
The goal of this exercise is to search in a rotated array for a given number in a sorted array. Try to solve the problem using binary search.
Problem statement: Search for a given number in a sorted array, with unique elements, that has been rotated by some arbitrary number, assuming that the array does not contain duplicates. Return -1 if the number does not exist.
Below is an original array before rotation:
After performing rotation on this array 6 times, it changes to:
Try it yourself below before checking the solution.
The solution is like a binary search with some modifications. Notice that at least one half of the array is always sorted. If the number n lies within the sorted half of the array, then our problem is a basic binary search. Otherwise, discard the sorted half and examine the unsorted half.
Runtime complexity: Logarithmic,
Memory complexity: Logarithmic,
Implement a LRU cache#
The goal of this design exercise is to implement Least Recently Used (LRU), a common caching strategy, using a doubly linked list and hashing.
Problem statement: Least Recently Used (LRU) defines the policy to evict elements from the cache to make room for new elements when the cache is full, meaning it discards the least recently used items first.
Take an example of a cache that has a capacity of 4 elements. We cache the elements 1, 2, 3, and 4. This diagram below represents the cache state after first access of all four elements.
We now need to cache another element 5.
Let’s see what happens when 2 is accessed again. Now 3 becomes the next in line to be evicted from the cache.
Try it yourself below before checking the solution.
Caching is a technique to store data in a faster storage (usually RAM) to serve future requests faster. Cache stores are usually not big enough to store a full data set. We need to evict data from the cache when it becomes full.
LRU is very simple and a commonly used algorithm for this process. We evict the oldest data from the cache to accommodate new data.
To implement an LRU cache we use two data structures: a hashmap and a doubly linked list. A doubly linked list helps in maintaining the eviction order and a hashmap helps with lookup of cached keys. Here is the algorithm:
If the element exists in hashmap
move the accessed element to the tail of the linked list
Otherwise,
if eviction is needed i.e. cache is already full
Remove the head element from doubly linked list and delete its hashmap entry
Add the new element at the tail of linked list and in hashmap
Get from Cache and Return
Note: The doubly linked list is for tracking the most recently accessed elements. The element at the tail of the doubly linked list is the most recently accessed element.
All newly inserted elements go to the tail, and any element accessed goes to the tail.
Runtime Complexity:
get (hashset): Constant,set (hashset): Constant,- Deletion at head when adding a new element: Constant,
- Search for deleting and adding to tail: Linear,
Memory Complexity: Linear, , where is the size of cache
Behavioral questions#
Now that we’ve discussed the top technical questions, let’s look at the most common behavioral interview questions you can expect at an Apple interview, which are arguably just as important for your success.
As you’ll see from this list, Apple wants to understand what kind of thinker you are, how you handle conflict, and what investments you bring to the table.
- What were some of your best and worst days over the last four years?
- What is your favorite Apple product or service, and why?
- Describe an achievement you are particularly proud of.
- Have you ever disagreed with your manager about a decision at work? What happened? How did you handle the situation?
- How have you overcome failure? What did you learn from it?
- Why do you want to work for Apple?
- What is the first thing you notice when walking into an Apple store?
- Describe the most challenging software development problem you faced. How did you solve it?
- If you accept a job at Apple, what will you miss most about your current role? What will you miss least?
- Do you take any steps to enhance your skills outside of work?
- Describe a time you went above and beyond for a customer
- Explain to a 8 year old what a modem/router is and its functions.
- How does this role fit into your 5 year career or life plan?
- If we hired you, what would you want to work on?
- How would you test your favorite app?
- If a person called for tech support but had a dinosaur or legacy product, how would you handle it?
Tip: Regardless of the question or position, it is always recommended to use STAR method for answering their behavioral-based interview questions:
- Describe the situation.
- Describe the task.
- Describe the action(s) taken to handle the task.
- Explain the results you achieved.
Tips for preparing for interviews#
Practicing for interviews takes tons of time and patience, and there is no golden ticket to cracking the coding interview. But there are some best practices we’ve learned over the years.
-
Practice with different tools. It’s a good idea to combine whiteboard practice, online courses, and mock interviews to get the most out of your time. It’s crucial that you practice talking aloud as you solve problems, so use different kinds of tolls to get practice.
-
Create a study plan. It is also recommended to create a detailed preparation plan for anywhere between 3-6 months. This way, you have a structure to follow and avoid missing essential concepts.
-
Avoid rote memorization. It is also recommended to avoid memorizing questions. Instead, practice by building real products that Apple might use. This is the ideal way to prepare for interviews: you learn the same concepts, practice problem-solving, and gain confidence actually building for Apple.
To get hands-on practice with 100+ real product features, check out Educative’s interview prep series Grokking Coding Interview Patterns Our team of experts has combed through the top interview questions and incorporated them into a carefully crafted set of scenarios for you to learn from.
After each project, we’ll show you what kinds of interview problems you’ll now be able to solve using the techniques you just applied.
Happy learning!
Continue reading about coding interviews#
Frequently Asked Questions
What kind of questions does Apple ask in a coding interview?
What kind of questions does Apple ask in a coding interview?
Is the Apple coding interview hard?
Is the Apple coding interview hard?