Amazon Interview Question

Remove the duplicate