#### most common apple coding interview questions

#### the 15 most asked questions in an apple interview

# Arrays

#### 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.

#### Merge overlapping intervals

# Problem statement

# â€‹

Given a list of intervals, merge all the overlapping intervals to produce a list that has only mutually exclusive intervals.

# linked lists

#### Add two integers

# Problem statement

# â€‹

Given the head pointers of two linked lists where each linked list represents an integer number (each node is a digit), add them and return the resulting linked list.

#### Merge two sorted linked lists

# Problem statement

# â€‹

Given two sorted linked lists, merge them so that the resulting linked list is also sorted.

# trees

#### Determine if two binary trees are identical

# Problem statement

# â€‹

Given the roots of two binary trees, determine if these trees are identical or not. Identical trees have the same layout and data at each node.

#### Mirror binary tree nodes

# Problem statement

# â€‹

Given the root node of a binary tree, swap the â€˜leftâ€™ and â€˜rightâ€™ children for each node.

# strings

#### Find all palindrome substrings

# Problem statement

# â€‹

Given a string find all non-single letter substrings that are palindromes.

#### Reverse words in a sentence

# Problem statement

# â€‹

Reverse the order of words in a given sentence (an array of characters).

# dynamic programming

#### Find the maximum sum of a subarray

# Problem statement

# â€‹

Given an array of positive numbers and a positive number â€˜kâ€™, find the maximum sum of any contiguous subarray of size â€˜kâ€™.

# Math and stats

#### Power of a number

# Problem statement

# â€‹

Given a double, â€˜xâ€™, and an integer, â€˜nâ€™, write a function to calculate â€˜xâ€™ raised to the power â€˜nâ€™.

# backtracking

#### Find all sum combinations

# Problem statement

# â€‹

Given a positive integer, target, print all possible combinations of positive integers that sum up to the target number.

# Graphs

#### Clone a directed graph

# Problem statement

# â€‹

# design

#### Implement a LRU cache

# Problem statement

# â€‹

Least Recently Used (LRU) is a common caching strategy. It 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.

# sorting and searching

#### Search in rotated array

# Problem statement

# â€‹

Search for a given number in a sorted array that has been rotated by some arbitrary number. Return -1 if the number does not exist. Assume that the array does not contain duplicates.

#### Merge overlapping intervals

# Problem statement

# â€‹

Given a list of intervals, merge all the overlapping intervals to produce a list that has only mutually exclusive intervals.

have you been asked a question that is not included here in your apple interview?

â€‹

please share with us:

Need help preparing for the interview?

â€‹

Check out the Definitive Interview Prep Roadmap,

written and reviewed by real hiring managers.