Amazon Interview Question

I dont really remember, but it was from leetcode