Apple interview question

Leetcode similar data structures and algorithm questions!