Wayfair | Phone | Warehouse Manager

Difficulty: EASYCategory: InterviewExperienceFrequency: 1Asked On 2020-01-18Added By Anonymous
Source: Link

After the online coding challenge on codility, a technical phone screen was scheduled with on of their tech lead. This was the following question asked.

Specification:


Create a class WarehouseManager whose API includes the following methods:

1class WarehouseManager { 2 3 /** 4 * Add a new product to the warehouse. 5 * 6 * @param productId The product’s ID. Unique to a product but there can be multiple copies of the same product in the warehouse 7 * @returns The number of those products currently in the warehouse 8 */ 9 public int addProduct(int productId) { 10 // todo 11 } 12 13 /** 14 * Ships the given order. This requires removing the products from the warehouse. 15 * 16 * @param products A list of product IDs 17 * @returns Whether or not we were able to ship the order. In order to ship an order, we must have all of the products in stock. 18 */ 19 public boolean shipOrder(List<Integer> products) { 20 // todo 21 } 22}


It was live coding session on codility. There were a couple of questions regarding the performance of the code and optimization.

Comments