Amazon Interview Question

Question on array and frequency of elements