Amazon Interview Question

How to handle the data? Any experience on this.