Apple | Phone | First Element that Appears Once
Anonymous User
3057

Had a phone screen with Apple a month or so ago for Safari UI Software Engineer role.

yoe: 2 years
level: ict3
location: Apple Park

length: 45 minutes

Note: Was asked to use Swift/C/Objective-C for this interview.

5 minutes: Q1 - Given a non sorted array of integers, return the first number that appears once in the array.

Solved using hashmap with O(n) space and O(n) time

arr = [1,2,3,4,5,6,1,2,3,6,7]
return 4
Explanation:
numbers 4, 5, 7 have frequency of 1 but 4 is the first.

5 minutes: follow up. What if the array is sorted?
Solved with O(n) time and O(1) space. Not sure if this can be solved in log(n) ?

arr = [1,1,2,2,3,3,4,5,6,6,7]
return 4

I spent the rest of the 35 minutes chatting with the interviewer. Never heard back from them.

Comments (7)