Amazon Interview Question

To do a leetcode problem