Apple Interview Question

Practice DSA and you should be good.