Apple is a global technology company known for building innovative products and software ecosystems. Apple Software Development Engineer (SDE) interviews focus on coding proficiency, Data Structures & Algorithms (DSA), problem-solving, and system design skills.
- Covers the complete Apple SDE interview process, including coding rounds, technical interviews, and hiring stages.
- Includes the most frequently asked Apple SDE interview questions with preparation tips for successful interview performance.
Topic-Wise DSA Questions
Array
An array is a linear data structure that stores elements of the same type in contiguous memory locations, enabling fast access using indices.
- Cyclically rotate an array by one. [ Practice problem]
- Program for array rotation. [ Practice problem]
- Adding one to a number represented an an array of digits. [Practice problem]
- Find the missing and repeating number [Practice Problem]
- Product of Array except itself [Practice problem]
- Find the Number Occurring Odd Number of Times [Practice problem]
- Round the given number to nearest multiple of 10 [Practice problem]
- Elements in the Range [Practice problem]
- Find zeroes to be flipped so that number of consecutive 1’s is maximized [Practice problem]
- Equilibrium index of an array [Practice problem]
- Top k numbers in a stream [Practice problem]
- Rotate a 2D array without using extra space [Practice problem]
- Container With Most Water [Practice Problem]
- Trapping Rain Water [Practice Problem]
String
Strings are defined as an array of characters. The difference between a character array and a string is the string is terminated with a special character ‘\0’.
- Program to validate an IP address [ Practice Problem ]
- Implement Atoi [ Practice Problem ]
- Program to Check if a Given String is Palindrome [Practice Problem ]
- Check whether two strings are anagram of each other [ Practice Problem ]
- Write a program to print all permutations of a given string [Practice Problem ]
- Remove duplicates from a given string [ Practice Problem ]
- Find Excel column name from a given column number [ Practice Problem ]
- Length of the longest valid substring [ Practice Problem ]
- Converting Decimal Number lying between 1 to 3999 to Roman Numerals [ Practice Problem ]
- Given a sequence of words, print all anagrams together [ Practice Problem]
- Longest prefix which is also suffix [ Practice Problem ]
- Find if an array of strings can be chained to form a circle [ Practice Problem ]
- Z-Algorithm (Pattern Searching) [Practice Problem]
- Smallest window in a String containing all characters of other String [Practice Problem]
- Rabin-Karp Algorithm for Pattern Searching [Practice Problem]
Linked List
A linked list is a linear data structure where elements are stored in non-contiguous memory locations and linked using pointers.
- Delete a Node in Single Linked List [Practice Problem]
- Reverse a linked list [Practice Problem ]
- Reverse a Linked List in groups of given size[Practice Problem]
- Check if a linked list is Circular Linked List [ Practice Problem ]
- Multiply two numbers represented by Linked Lists [Practice Problem]
- Reverse a sublist of linked list [Practice Problem]
- Implement a stack using singly linked list [Practice Problem]
- Convert a given Binary Tree to Doubly Linked List [Practice Problem]
- Length of longest palindrome in linked list [Practice Problem]
- Find length of loop in linked list [Practice Problem]
- Clone a linked list with next and random pointer [Practice Problem]
- Flatten a binary tree into linked list [Practice Problem]
- Detect Cycle in Linked List [Practice Problem]
- Intersection point of two linked lists [Practice Problem]
Stack
A stack is a linear data structure that follows the LIFO (Last In, First Out) principle, allowing insertion and deletion from only one end.
- Implement Stack using Queues [Practice Problem]
- Design a stack that supports getMin() in O(1) time and O(1) extra space [Practice Problem]
- Length of the longest valid substring [Practice Problem]
- Maximum size rectangle binary sub-matrix with all 1s [Practice Problem]
- The Celebrity Problem [Practice Problem]
- The Stock Span Problem [Practice Problem]
- Clone a stack without extra space [Practice Problem]
- Delete middle element of a stack [Practice Problem]
Queue
A queue is a linear data structure that follows the FIFO (First In, First Out) principle, with insertion at the rear and deletion from the front.
- Reversing a Queue [Practice Problem]
- Find the first circular tour that visits all petrol pumps [Practice Problem]
- Minimum time required to rot all oranges [Practice Problem]
- Snake and Ladder Problem [Practice Problem]
- Minimum steps to reach target by a Knight [Practice Problem]
Searching
Searching algorithms are used to locate a specific element or determine its position within a data structure efficiently.
- Find last index of a character in a string [Practice Problem]
- Number of pairs in an array with the sum greater than 0 [Practice Problem]
- Majority Element [Practice Problem]
- Find a peak element [Practice Problem]
- Find the transition point in a binary array [Practice Problem ]
- Find common elements in three sorted arrays [Practice Problem]
- Leaders in an array [Practice Problem]
- Find a pair with the given difference [Practice Problem]
- Find bitonic point in given bitonic sequence [Practice Problem]
- Capacity To Ship Packages Within D Days [Practice Problem]
- Search in a Sorted and Rotated Array [Practice Problem]
- 3 Sum - Find All Triplets with Zero Sum [Practice Problem]
Sorting
The sorting algorithms rearrange elements in a collection into a specific order (ascending or descending) to improve efficiency in searching and processing.
- QuickSort [Practice Problem]
- Sort in a specific order [Practice Problem]
- K’th Smallest/Largest Element in Unsorted Array [Practice Problem]
- Sort an array of 0s, 1s and 2s [Practice Problem]
- Count Inversions in an array [Practice Problem]
- Find a triplet that sums to a given value [Practice Problem]
- Find subarray with given sum [Practice Problem]
- Chocolate Distribution Problem [Practice Problem]
- The minimum sum of two numbers formed from digits of an array [Practice Problem]
- Largest even number that can be formed by any number of swaps [Practice Problem]
- Sort elements by frequency [Practice Problem]
- Chocolate Distribution Problem [Practice Problem]
Hash
Hashing is a technique that maps data to fixed-size values using hash functions for fast insertion, deletion, and lookup.
- Count pairs with a given sum [Practice Problem]
- The longest sub-array having sum k [Practice Problem]
- Zero Sum Subarrays [Practice Problem]
- Union of Two Linked Lists [Practice Problem]
- Check if an array can be divided into pairs whose sum is divisible by k [Practice Problem]
- Longest Consecutive Subsequence [Practice Problem]
- Triplet Sum in Array [Practice Problem]
- Largest subarray of 0's and 1's [Practice Problem]
- Count Full Distinct Subarrays [Practice Problem]
- Check If Array Pair Sums Divisible by k [Practice Problem]
Heap
Heap is a specialized tree-based data structure that satisfies the heap property and is commonly used for priority-based problems.
- Merge K sorted Linked lists [Practice Problem]
- Operations on Binary Min Heap [Practice Problem]
- Rearrange characters in a String such that no two adjacent characters are same [Practice Problem]
- Check if a given Binary Tree is a Heap [Practice Problem]
Recursion
Recursion is a programming technique where a function calls itself to solve a problem by breaking it into smaller subproblems.
- Tower Of Hanoi [Practice Problem]
- Recursively remove all adjacent duplicates [Practice Problem]
- Special Keyboard [Practice Problem]
- Generate IP Addresses [Practice Problem]
- Lucky Numbers [Practice Problem]
- Diagonal Sum of a Binary Tree [Practice Problem]
- Generate n-bit Gray Codes [Practice Problem]
- Word Break [Practice Problem]
Backtracking
Backtracking is a recursive approach that explores all possible solutions by incrementally building candidates and abandoning invalid paths.
- Backtracking to find all subsets [Practice Problem]
- Rat in a Maze Problem [Practice Problem]
- Coloring Problem [Practice Problem]
- Partition array to K subsets [Practice Problem]
- Printing all solutions in N-Queen Problem [Practice Problem]
- Sudoku Solver [Practice Problem]
Tree
A tree is a hierarchical, non-linear data structure consisting of nodes connected by edges, commonly used to represent relationships.
- Sorted Array to Balanced BST [Practice Problem]
- Level Order Binary Tree Traversal [Practice Problem]
- Reverse Level Order Traversal [Practice Problem]
- Print level order traversal line by line [Practice Problem]
- Left View of Binary Tree [Practice Problem]
- Boundary Traversal of binary tree [Practice Problem]
- Vertical Traversal of Binary Tree [Practice Problem]
- Check if two Nodes are Cousins [Practice Problem]
- Binary Tree to DLL [Practice Problem]
- Serialize and Deserialize a Binary Tree [Practice Problem]
- Convert a Binary Tree to a Circular Doubly Link List [Practice Problem]
- A program to check if a binary tree is BST or not [Practice Problem]
- Find the node with minimum value in a Binary Search Tree [Practice Problem]
- Lowest Common Ancestor in a Binary Tree [Practice Problem]
- Lowest Common Ancestor in a Binary Search Tree. [Practice Problem]
- Maximum difference between node and its ancestor in Binary Tree [Practice Problem]
- Balanced Binary Tree or Not [Practice Problem]
- Largest BST in a Binary Tree [Practice Problem]
Graph
A Graph is a non-linear data structure made up of vertices and edges, used to model real-world relationships and networks.
- Bipartite Graph [Practice Problem]
- Detect cycle in a directed graph [Practice Problem]
- Detect cycle in an undirected graph [Practice Problem]
- Topological sort [Practice Problem]
- Minimum Spanning Tree [Practice Problem]
- Minimum steps to reach target by a Knight [Practice Problem]
- Strongly Connected Components (Kosaraju's Algo) [Practice Problem]
- Snake and Ladder Problem [Practice Problem]
- Word Boggle [Practice Problem]
- Find whether it is possible to finish all tasks or not from given dependencies [Practice Problem]
- Bridges in a graph [Practice Problem]
- Flood Fill Algorithm [Practice Problem]
- Given a matrix of ‘O’ and ‘X’ if surrounded by 'X' [Practice Problem]
- Dijkstra's Algorithm [Practice Problem]
Dynamic Programming
Dynamic Programming optimizes recursive solutions by storing and reusing results of overlapping subproblems to reduce time complexity.
- Find if a string is interleaved of two other strings [Practice Problem]
- Max rectangle [Practice Problem]
- Palindrome Partitioning [Practice Problem]
- Number of Unique BST with a given key [Practice Problem]
- Boolean Parenthesization Problem [Practice Problem]
- Number of Coins [Practice Problem]
- Egg Dropping Puzzle [Practice Problem]
- Word Break [Practice Problem]
- Wildcard Pattern Matching [Practice Problem]
- Total Decoding Messages [Practice Problem]
- Jump Game [Practice Problem]
- Longest Increasing Subsequence[Practice Problem]
- Painting Fence Algorithm[Practice Problem]
- Count All Palindrome Sub-Strings in a String[Practice Problem]
- Count ways to reach the n’th stair [Practice Problem]
- Burst Balloon to maximize coins [Practice Problem]
- Coin Change - Count Ways to Make Sum [Practice Problem]
- Program to find amount of water in a given glass [Practice Problem]