Amazon Interview Question

Whiteboard coding test - Write two methods. Method 1 - stores order data(customer id, product id) Method 2 - Returns product with maximum orders.

Interview Answer

Anonymous

Feb 11, 2025

Method 1: Store the order list in a thread-safe dictionary with the productid as key and the value - number of times order was placed. Method 2: Return the key of the dictionary which has the highest value.