Apple interview question

leetcode medium, array stuff. sfss