Apple interview question

Practice DSA and you should be good.