Apple Software Engineer Interview Questions

Review this list of 82 Apple software engineer interview questions and answers verified by hiring managers and candidates.
  • Apple logoAsked at Apple 
    +7

    "from typing import List def traprainwater(height: List[int]) -> int: if not height: return 0 l, r = 0, len(height) - 1 leftMax, rightMax = height[l], height[r] res = 0 while l < r: if leftMax < rightMax: l += 1 leftMax = max(leftMax, height[l]) res += leftMax - height[l] else: r -= 1 rightMax = max(rightMax, height[r]) "

    Anonymous Roadrunner - "from typing import List def traprainwater(height: List[int]) -> int: if not height: return 0 l, r = 0, len(height) - 1 leftMax, rightMax = height[l], height[r] res = 0 while l < r: if leftMax < rightMax: l += 1 leftMax = max(leftMax, height[l]) res += leftMax - height[l] else: r -= 1 rightMax = max(rightMax, height[r]) "See full answer

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

    "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]["

    Vince 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

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

    "Reproduce the bug, read error messages, isolate the problem, use a debugger, check assumptions, review recent changes, consult documentation, Text Edge Cases, take break"

    Jennifer C. - "Reproduce the bug, read error messages, isolate the problem, use a debugger, check assumptions, review recent changes, consult documentation, Text Edge Cases, take break"See full answer

    Software Engineer
    Behavioral
  • Apple logoAsked at Apple 

    "na"

    Nishigandha B. - "na"See full answer

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

  • Apple logoAsked at Apple 
    Software Engineer
    Behavioral
  • Apple logoAsked at Apple 
    Software Engineer
    Data Structures & Algorithms
    +1 more
  • Apple logoAsked at Apple 
    +6

    "function isPalindrome(s, start, end) { while (s[start] === s[end] && end >= start) { start++; end--; } return end <= start; } function longestPalindromicSubstring(s) { let longestPalindrome = ''; for (let i=0; i < s.length; i++) { let j = s.length-1; while (s[i] !== s[j] && i <= j) { j--; } if (s[i] === s[j]) { if (isPalindrome(s, i, j)) { const validPalindrome = s.substring(i, j+1"

    Tiago R. - "function isPalindrome(s, start, end) { while (s[start] === s[end] && end >= start) { start++; end--; } return end <= start; } function longestPalindromicSubstring(s) { let longestPalindrome = ''; for (let i=0; i < s.length; i++) { let j = s.length-1; while (s[i] !== s[j] && i <= j) { j--; } if (s[i] === s[j]) { if (isPalindrome(s, i, j)) { const validPalindrome = s.substring(i, j+1"See full answer

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

    "Make current as root. 2 while current is not null, if p and q are less than current, go left. If p and q are greater than current, go right. else return current. return null"

    Vaibhav D. - "Make current as root. 2 while current is not null, if p and q are less than current, go left. If p and q are greater than current, go right. else return current. return null"See full answer

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

    "Leetcode 347: Heap + Hashtable Follow up question: create heap with the length of K instead of N (more time complexity but less space )"

    Chen J. - "Leetcode 347: Heap + Hashtable Follow up question: create heap with the length of K instead of N (more time complexity but less space )"See full answer

    Software Engineer
    Coding
    +3 more
  • Apple logoAsked at Apple 

    "Function that transforms each elements in a collection and returns new collection with transformed elements"

    Susmita S. - "Function that transforms each elements in a collection and returns new collection with transformed elements"See full answer

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

    "filter function usually exists in some high level programming that adopt FP paradigm. It taks a sequence of items and a predicate function, and returns (conceptually) a subset of the items that satisfy the predicate. Adopt this kind of operation (filter, map, reduce, take, pairwise ...) can help writting cleaner code, and reduce the usage of mutable part in the program, lower the possibility of making human mistake. Take Python for example (although const-ness is not exists in Python), assu"

    Weida H. - "filter function usually exists in some high level programming that adopt FP paradigm. It taks a sequence of items and a predicate function, and returns (conceptually) a subset of the items that satisfy the predicate. Adopt this kind of operation (filter, map, reduce, take, pairwise ...) can help writting cleaner code, and reduce the usage of mutable part in the program, lower the possibility of making human mistake. Take Python for example (although const-ness is not exists in Python), assu"See full answer

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

    "import java.util.Arrays; import java.util.stream.Collectors; class Main { // Recursive function to print all combinations of numbers from \i\ to \n\ // having sum \n. The index\ denotes the next free slot in the output array \out\ public static void printCombinations(int i, int n, int[] out, int index) { // if the sum becomes n, print the combination if (n == 0) { System.out.println(Arrays.stream(out).limit(index) .boxed().collect(Collectors.toList())); } // start from the previous e"

    Relynn may silver B. - "import java.util.Arrays; import java.util.stream.Collectors; class Main { // Recursive function to print all combinations of numbers from \i\ to \n\ // having sum \n. The index\ denotes the next free slot in the output array \out\ public static void printCombinations(int i, int n, int[] out, int index) { // if the sum becomes n, print the combination if (n == 0) { System.out.println(Arrays.stream(out).limit(index) .boxed().collect(Collectors.toList())); } // start from the previous e"See full answer

    Software Engineer
    Data Structures & Algorithms
    +4 more
Showing 61-80 of 82