# Common Apple interview questions (with preparation tips)

Many developers dream about working at Apple. But, for their dream to become a reality, they should overcome the Apple interview (and the coding round), which is not a simple task. The tech giant Apple, since January 2021, is the world’s most valuable company. The number of employees in Apple from 2005 to 2021 reached around 148 thousand.

The Apple interview process is very standard and similar to other FAANG companies. It depends on the position you are applying for. The interview process for software engineers takes 1-2 months. Employees at Apple work long hours, but compensation here is on the high end of the spectrum (for all positions). Working at Apple has a lot of benefits.

*See also:*

*FAANG interview preparation- A step-by-step guide to crack FAANG interview**Common Amazon coding interview questions*

If you want to crack the Apple interview, you are in the right place, so keep reading. In this article, I’ll explain every step that takes you to get a job at Apple. I’ll direct you on what to focus on and will provide the top Apple coding questions for facilitating your preparation.

**Here’s an overview:**

- Apple interview process
- Apple interview questions
- Apple technical interview questions
- Top coding interview questions
- Preparation tips

## 1. Apple interview process

Getting an interview with Apple means you already got yourself in the top 5% of the self-selected applicants. In the interview process, the company tests your technical expertise and communication skills to determine if you are the best fit instead of the other candidates, which were in the top 5%. The Apple interview process differs from other tech companies in that Apple has a two-on-one approach (two employees interviewing the candidate).

The interview process looks like following:

- Phone screen with the recruiter (this stage includes some technical questions)
- Phone screen with the hiring manager
- Technical phone screen with an engineer (including coding challenge on shared platform + other technical questions). The coding interviews are 45-60 minutes. You have 30 minutes for the coding challenge.
- Onsite interview (the onsite interview lasts around 5 hours, including 5 rounds with each team. Apple interviews are team- based. Over one team interviews the candidates. The questions in the onsite interview are typical coding algorithms, data structure, and design questions).

## 2. Apple (coding) interview questions

Apple asks a combination of challenging puzzle-based and behavioral interview questions. Below, I broke down into 5 categories the most common Apple interview questions. With a focus on Apple, coding interview questions.

- Behavioral
- Leadership
- Technical
- Company-specific
- Competency-based

### 2.1 Apple technical interview questions list

- Given a list of integers, write a function that finds all the pairs of numbers that sum less than or equal to K.
- Write an algorithm that finds the next node (post-order successor) of a given node in a binary tree and BST, where each node has a link to its parent and without a parent pointer.
- Given two trees, write a function that determines if tree #2 is the mirror image of tree #1.
- What is an NSDictionary and how would you implement it?
- Given a BST and a number K, write a function that checks whether two nodes in the BST whose sum is equal to K exist.
- Given inputs from Google Search and K chunks, write a function that merges all chunks into a single alphabetically ordered list.
- Given an integer array, write a function that adjusts each integer so that the difference of every adjacent integer so that they’re not greater than K.
- Given a set of intervals, write a function that finds the set of intervals that overlap.
- Implement a vector-like data structure from scratch.
- Is there a restriction on the types of objects that can be serialized?
- What are ways to extend classes in Objective-C?
- What is the maximum number of edges you could add to N vertexes to make an acyclic undirected graph?
- At the Kernel level, how would you write a memory leak analyzer and how would you implement it?
- Given a very large array of integers, write a function that finds the 2nd max value.
- Write a method that returns the first five 10 digit prime numbers.
- Given an array of positive and negative numbers, write a function that arranges them such that every positive number is followed by a negative number and vice-versa.
- Write a function that squares a number without using * or the carrot sign.
- Write a function that inserts an element in a sorted circular linked list.
- Write an algorithm to get the maximum and second maximum element of a stack.
- Given an array of integers and a range (low, high), write a function that finds all continuous subsequences in the array which have a sum in the range.
- Given a list of integers that fall within a known short range of values (full range unknown), write a function that finds the median value.
- Write a function that stores a set of sudden-death tournament results and a set of predicted match results in a compact format. Then, score the predictions, giving one point per correctly guessed match.
- Count the number of positive integers less than N that do not contain the digit 4.
- Write a function that finds the median of a stream of flowing numbers.
- Implement an iterator that efficiently iterates the nodes of a binary search tree by value in ascending order.

### 2.2 Top Apple coding interview questions

#### 1. Reverse Words In A String

Avg. time to solve - 10 min.

*Problem Statement*

You are given a string of length N. You need to reverse the string word by word. There can be multiple spaces between two words and there can be leading or trailing spaces but in the output reversed string you need to put a single space between two words, and your reversed string should not contain leading or trailing spaces.

`For example :`

`If the given input string is " Welcome to Interview help", then you should return "Help interview to welcome" as the reversed string has only a single space between two words and there is no leading or trailing space.`

`Input Format :`

`The first line of input contains a single integer T, representing the number of test cases or queries to be run.`

`Then the T test cases follow.`

`The first and only one of each test case contains a string that you need to reverse word by word.`

`Output Format :`

`For every test case, print the reversed string such that there should be only one space between two strings and there should not be any trailing space.`

`Note :`

`Do not print anything. It has already been taken care of.`

`Constraints :`

`1 <= T <= 50`

`0 <= N <= 10^5`

`Time Limit: 1 sec`

#### 2. Rotting oranges

Avg. time to solve - 20 min

*Problem Statement*

You have been given a grid containing some oranges. Each cell of this grid has one of the three integers values:

Value 0 - representing an empty cell.

Value 1 - representing a fresh orange.

Value 2 - representing a rotten orange.

Every second, any fresh orange that is adjacent(4-directionally) to a rotten orange becomes rotten.

Your task is to find out the minimum time after which no cell has a fresh orange. If it’s impossible to rot all the fresh oranges then print -1.

`Note:`

`1. The grid has 0-based indexing.`

`2. A rotten orange can affect the adjacent oranges 4 directionally i.e. Up, Down, Left, Right.`

`Input format:`

`The first line of input contains two single space-separated integers 'N' and 'M' representing the number of rows and columns of the grid respectively.`

`The next 'N' lines contain 'M' single space-separated integers each representing the rows of the grid.`

`Output format:`

`The only line of output contains a single integer i.e. The minimum time after which no cell has a fresh orange.`

`If it's impossible to rot all oranges, print -1.`

`Note: You are not required to print the expected output, it has already been taken care of. Just implement the function.`

`Constraints:`

`1 <= N <= 500`

`1 <= M <= 500`

`0 <= grid[i][j] <= 2`

`Time Limit: 1 sec`

#### 3. Search in rotated sorted array

Avg. time to solve 30 min.

*Problem Statement*

I took a sorted array and rotated it clockwise by an unknown amount. For example, I took a sorted array = [1, 2, 3, 4, 5] and if I rotate it by 2, then the array becomes: [4, 5, 1, 2, 3].

After rotating a sorted array, my friend needs to answer Q queries asked by me, each of them is described by one integer Q[i]. which I wanted him to search in the array. For each query, if he found it, he had to shout the index of the number, otherwise, he had to shout -1.

For each query, you have to complete the given method where ‘key’ denotes Q[i]. If the key exists in the array, return the index of the ‘key’, otherwise, return -1.

`Note:`

`Can you solve each query in O(logN)?`

`Input Format:`

`The first line of input contains the size of the array: N`

`The second line contains N single space-separated integers: A[i].`

`The third line of input contains the number of queries: Q`

`The next Q lines of input contain: the number which I want my friend to search: Q[i]`

`Output Format:`

`For each test case, print the index of the number if found, otherwise -1.`

`Output for every test case will be printed in a separate line.`

`Note:`

`You are not required to explicitly print the expected output, just return it and printing has already been taken care of.`

`Constraints:`

`1 <= N <= 10^6`

`-10^9 <= A[i] <= 10^9`

`1 <= Q <= 500`

`-10^9 <= Q[i] <= 10^9`

`Time Limit: 1sec`

*Your Apple interview is on the corner? Want to check out the complete solutions to the problems above and to check out more interview problems as well, for your better preparation?* *Join our site* *for more interview problems with complete solutions.*

### Schedule your free consultation today and get answers to all your questions

#### 4. Excel column number

Avg. time to solve 23min.

*Problem Statement*

You have been given a column title as appears in an Excel sheet, return its corresponding column number.

`For Example:`

`A -> 1`

`B -> 2`

`C -> 3`

`...`

`Z -> 26`

`AA -> 27`

`AB -> 28`

`…`

`Input Format`

`The only line of input contains a string S i.e. column title`

`Constraints:`

`1 <= |S| <= 10`

`The input contains only uppercase English Alphabet letters`

`Time Limit: 1 sec`

`Output Format`

`The only line of output will print the column number corresponding to the given column title`

#### 5. Palindrome partitioning

Avg. time to solve 25 min.

*Problem Statement*

You are given a string ‘S’. Your task is to partition ‘S’ such that every substring of the partition is a palindrome. You need to return all possible palindrome partitioning of ‘S’.

**_Note: _**A substring is a contiguous segment of a string.

`For Example:`

`For a given string “Baab”`

`3 possible palindrome partitioning of the given string are:`

`{“B”, “a”, “a”, “B”}`

`{“B”, “aa”, “B”}`

`{“Baab”}`

`Every substring of all the above partitions of “Baab” is a palindrome.`

`Input Format:`

`The only line of input contains a string 'S'.`

`Output Format:`

`For each test case, print all the possible palindromic partitions of the given string in a separate line.`

`Each substring of a partition is written within quotes(““) and separated by comma(,) and space, and each partition of the given string is written inside square brackets[].`

`The output of each test case will be printed in a separate line.`

`Note:`

`All the substrings of a partition are sorted in lexicographical order in the output. You just need to return the partitions in any order.`

`You do not need to print or sort anything, it has already been taken care of. Just implement the function.`

`Constraints:`

`0 <= |S|<= 15`

`where |S| denotes the length of string 'S'.`

`Time Limit: 1 sec.`

## 3. Strategies for cracking the Apple coding round (topics to focus on and preparation tips)

The strategies for cracking coding rounds differ from organization to organization and also vary depending on the position that they are hiring you. Therefore, the primary job is to judge what the company is looking for and then prepare in the relevant direction.

I’ll give you an idea of what to focus on when preparing for the Apple coding round and a list of tips for your better preparation.

### 3.1 Topics to focus on for coding round and its percentage of frequency in the questions:

- Data Structures: 63%
- Algorithms: 16%

### 3.2 Topics on core DS/algorithms

- Arrays, strings, & linked lists
- Sorting algorithms
- Hash tables & queues
- Recursion
- Trees & graphs
- Graph algorithms
- Dynamic programming

### 3.3 Proven preparation tips for Apple coding round

- Take your problem-solving skills to the next level.

Do you want to get good at problem-solving? Practice problem solving every day. It’s the central thing to cracking the coding interview. Cracking the coding interview has good practice problems, from beginner to intermediate level. You can practice even more problems by getting them from sites like Interview help and Glassdoor. Don’t just read the solutions, practice problem solving yourself. The most important thing is to write down solid code instead of solving problems in your mind. Solve at least 1-2 problems every day, at least 10-12 weeks before the interview.

- Give yourself enough time for preparation

Everyone is different and how much practice one needs depends on individual background. It’s all about having the skills and how good you are, isn’t about how many hours you spent on it if you are not good enough. To crack a top company, you’d better be certain that coding is your passion.

However, interviewing requires lots of practice and lots of interviewing experience. So, it’s good to give yourself at least 10 weeks of preparation. 12 weeks is a solid time for boosting your problem-solving skills.

- Use mock interviews

A mock interview is a practice interview done to prepare you for the real interview to come. It’s normally as close to the interview as you’d expect, but with feedback from the mock interviewer on how you did so, you can refine your answers and be ready for different interview situations.

Are you looking for the right resource for your mock interview?

### Ready to enroll your first mock interview?

- Give yourself rest the day before the interview

Stop the prep process a day before the interview, and have a well-rested mind by sleeping a full 8 hours, having a nice warm shower, enjoyable meal, and entertaining good positive thoughts. It’s a good time to avoid negative interactions, fighting, and all that stuff that could drain your mental energy.

*I hope this article helps. Good luck with your Apple interview ahead.*