US Interview Question
Software EngineersTeam: Amazon Prime
Country: United States
Interview Type: In-Person
Case 1) a product is given. Find the highest sale quantity and date
Ans: Traverse the file and create a heap(Max/Min) for each product. Heap may be in the array format. Each array is put as a value in a HashMap and key is the Product id. So the HashMap holds the values as Heap array and key as product id.
Case 2) A Date is given. Find the highest sold product and quantity.
Ans. Same. Only difference is that the Date will be the key for the HashMap.
I believe he wanted to test the speed of solving some certain tasks that doesn't really need code, it can be simply solved using awk from linux :)
- alexalghisi March 24, 2015