Skip to main content

Apple Interview Questions

Review this list of 145 Apple interview questions and answers verified by hiring managers and candidates.
  • Apple logoAsked at Apple 
    4 answers
    +1

    "static boolean sudokuSolve(char board) { return sudokuSolve(board, 0, 0); } static boolean sudokuSolve(char board, int r, int c) { if(c>=board[0].length) { r=r+1; c=0; } if(r>=board.length) return true; if(boardr=='.') { for(int num=1; num<=9; num++) { boardr=(char)('0' + num); if(isValidPosition(board, r, c)) { if(sudokuSolve(board, r, c+1)) return true; } boardr='.'; } } else { return sudokuSolve(board, r, c+1); } return false; } static boolean isValidPosition(char b"

    Divya R. - "static boolean sudokuSolve(char board) { return sudokuSolve(board, 0, 0); } static boolean sudokuSolve(char board, int r, int c) { if(c>=board[0].length) { r=r+1; c=0; } if(r>=board.length) return true; if(boardr=='.') { for(int num=1; num<=9; num++) { boardr=(char)('0' + num); if(isValidPosition(board, r, c)) { if(sudokuSolve(board, r, c+1)) return true; } boardr='.'; } } else { return sudokuSolve(board, r, c+1); } return false; } static boolean isValidPosition(char b"See full answer

    Software Engineer
    Data Structures & Algorithms
    +4 more
  • Apple logoAsked at Apple 
    3 answers

    "I was able to provide the optimal approach and coded it up"

    Anonymous Wasp - "I was able to provide the optimal approach and coded it up"See full answer

    Data Engineer
    Data Structures & Algorithms
    +2 more
  • Apple logoAsked at Apple 
    1 answer

    "A red-black tree is a self-balancing binary search tree. The motivation for this is that the benefits of O(logN) search, insertion, and deletion that a binary tree provides us will disappear if we let the tree get too "imbalanced" (e.g. there are too many nodes on one side of the tree or some branches have a depth that is way out of proportion to the average branch depth). This imbalance will occur if we don't adjust the tree after inserting or deleting nodes, hence our need for self-balancing c"

    Alex M. - "A red-black tree is a self-balancing binary search tree. The motivation for this is that the benefits of O(logN) search, insertion, and deletion that a binary tree provides us will disappear if we let the tree get too "imbalanced" (e.g. there are too many nodes on one side of the tree or some branches have a depth that is way out of proportion to the average branch depth). This imbalance will occur if we don't adjust the tree after inserting or deleting nodes, hence our need for self-balancing c"See full answer

    Software Engineer
    Data Structures & Algorithms
    +1 more
  • Apple logoAsked at Apple 
    Add answer
    Machine Learning Engineer
    Concept
  • Apple logoAsked at Apple 
    1 answer

    "public class HashMap { public class Element { T key; V value; Element(T k, V v) { this.key = k; this.value = v; } } private static final int DEFAULT_CAPACITY = 16; private static final float LOAD_FACTOR = 0.75f; private LinkedList[] table = new LinkedList[DEFAULT_CAPACITY]; private int size = 0; private int threshold = (int) (DEFAULTCAPACITY * LOADFACTOR); public void put(T k"

    Md kamrul H. - "public class HashMap { public class Element { T key; V value; Element(T k, V v) { this.key = k; this.value = v; } } private static final int DEFAULT_CAPACITY = 16; private static final float LOAD_FACTOR = 0.75f; private LinkedList[] table = new LinkedList[DEFAULT_CAPACITY]; private int size = 0; private int threshold = (int) (DEFAULTCAPACITY * LOADFACTOR); public void put(T k"See full answer

    Software Engineer
    Data Structures & Algorithms
    +2 more
  • 🧠 Want an expert answer to a question? Saving questions lets us know what content to make next.

  • Apple logoAsked at Apple 
    3 answers

    "class TrieNode { constructor() { this.children = {}; this.isEndOfWord = false; } } class Trie { constructor() { this.root = new TrieNode(); } insert(word) { let node = this.root; for (const char of word) { if (!node.children[char]) { node.children[char] = new TrieNode(); } node = node.children[char]; } node.isEndOfWord = true; } search(word) { l"

    Tiago R. - "class TrieNode { constructor() { this.children = {}; this.isEndOfWord = false; } } class Trie { constructor() { this.root = new TrieNode(); } insert(word) { let node = this.root; for (const char of word) { if (!node.children[char]) { node.children[char] = new TrieNode(); } node = node.children[char]; } node.isEndOfWord = true; } search(word) { l"See full answer

    Data Engineer
    Data Structures & Algorithms
    +3 more
  • Apple logoAsked at Apple 
    2 answers

    "Add more social features"

    Claire W. - "Add more social features"See full answer

    Product Manager
    Product Strategy
  • Apple logoAsked at Apple 
    Add answer
    Machine Learning Engineer
    Technical
  • Apple logoAsked at Apple 
    1 answer

    "Message queue is like a buffer. Its has 3 parts: Producer -> which creates a message and sends it to the queue. Queue -> which acta like a buffer pipe and stores the message. Subscriber -> which processes and releases messages one by one in FIFO manner."

    Rasika D. - "Message queue is like a buffer. Its has 3 parts: Producer -> which creates a message and sends it to the queue. Queue -> which acta like a buffer pipe and stores the message. Subscriber -> which processes and releases messages one by one in FIFO manner."See full answer

    Software Engineer
    System Design
  • Apple logoAsked at Apple 

    Permutations

    IDE
    Medium
    3 answers

    "function permute(nums) { if (nums.length <= 1) { return [nums]; } const prevPermutations = permute(nums.slice(0, nums.length-1)); const currentNum = nums[nums.length-1]; const permutations = new Set(); for (let prev of prevPermutations) { for (let i=0; i < prev.length; i++) { permutations.add([...prev.slice(0, i), currentNum, ...prev.slice(i)]); } permutations.add([...prev, currentNum]); } return [...permutations]"

    Tiago R. - "function permute(nums) { if (nums.length <= 1) { return [nums]; } const prevPermutations = permute(nums.slice(0, nums.length-1)); const currentNum = nums[nums.length-1]; const permutations = new Set(); for (let prev of prevPermutations) { for (let i=0; i < prev.length; i++) { permutations.add([...prev.slice(0, i), currentNum, ...prev.slice(i)]); } permutations.add([...prev, currentNum]); } return [...permutations]"See full answer

    Software Engineer
    Data Structures & Algorithms
    +3 more
  • Software Engineer
    Data Structures & Algorithms
  • Apple logoAsked at Apple 
    Add answer
    Video answer for 'Solve John Conway's "Game of Life".'
    Software Engineer
    Data Structures & Algorithms
    +2 more
  • Apple logoAsked at Apple 
    Add answer
    Software Engineer
    System Design
  • Apple logoAsked at Apple 
    Add answer
    Machine Learning Engineer
    Concept
  • Apple logoAsked at Apple 
    Add answer
    Product Design
  • Apple logoAsked at Apple 
    Add answer
    Software Engineer
    Behavioral
    +1 more
  • Apple logoAsked at Apple 
    1 answer

    "This is a pretty straightforward Improve a Product question. Let's first go over the Improve a Product formula: Ask clarifying questions Identify users, behaviors, and pain points State product goal Brainstorm small improvements Brainstorm bolder improvements Measure success Summarize Now, let's begin! Ask clarifying questions Before we begin listing off recommendations, it's important you ask questions to ensure you and the interviewe"

    Exponent - "This is a pretty straightforward Improve a Product question. Let's first go over the Improve a Product formula: Ask clarifying questions Identify users, behaviors, and pain points State product goal Brainstorm small improvements Brainstorm bolder improvements Measure success Summarize Now, let's begin! Ask clarifying questions Before we begin listing off recommendations, it's important you ask questions to ensure you and the interviewe"See full answer

    Product Manager
    Product Design
  • Apple logoAsked at Apple 
    2 answers

    "func isMatch(text: String, pattern: String) -> Bool { // Convert strings to arrays for easier indexing let s = Array(text.characters) let p = Array(pattern.characters) guard !s.isEmpty && !p.isEmpty else { return true } // Create DP table: dpi represents if s[0...i-1] matches p[0...j-1] var dp = Array(repeating: Array(repeating: false, count: p.count + 1), count: s.count + 1) // Empty pattern matches empty string dp[0]["

    Reno S. - "func isMatch(text: String, pattern: String) -> Bool { // Convert strings to arrays for easier indexing let s = Array(text.characters) let p = Array(pattern.characters) guard !s.isEmpty && !p.isEmpty else { return true } // Create DP table: dpi represents if s[0...i-1] matches p[0...j-1] var dp = Array(repeating: Array(repeating: false, count: p.count + 1), count: s.count + 1) // Empty pattern matches empty string dp[0]["See full answer

    Machine Learning Engineer
    Data Structures & Algorithms
    +3 more
  • Apple logoAsked at Apple 
    2 answers

    "I'd like the phone to send notifications according to one's schedule registered on the calendar app. For example, when I have a plan to hang out with my friends at the restaurant and it is expected to be raining at that time, I want my phone to send a notification saying don't forget to take your umbrella."

    Kanon A. - "I'd like the phone to send notifications according to one's schedule registered on the calendar app. For example, when I have a plan to hang out with my friends at the restaurant and it is expected to be raining at that time, I want my phone to send a notification saying don't forget to take your umbrella."See full answer

    Product Design
  • Apple logoAsked at Apple 
    3 answers

    "Sorting is a technique to arrange data in either increasing order or decreasing order, and, the function that implements this functionality is called sort function"

    Farhan -. - "Sorting is a technique to arrange data in either increasing order or decreasing order, and, the function that implements this functionality is called sort function"See full answer

    Software Engineer
    Data Structures & Algorithms
    +1 more
Showing 81-100 of 145