Amazon Interview Question

Array and Hashing type LC Question