Apple interview question

a twist on Leet code problem