Round 1: Online Assessment
Questions:
- Finding the number of pairs of a^b <= a&b in a given array.
- Some string questions, it was quite easy.
- Some combinatorial question (hard, but there were wrong test cases).
Candidate's Approach
No approach provided.
Interviewer's Feedback
No feedback provided.
Round 2: Machine Coding Round
Questions:
Question: Design an order management system for e-commerce.
The main functions to be implemented are:
addProduct(productid, quantity)
createOrder(orderid, list of product ids and their corresponding quantities)
confirmOrder(orderid)
getStock(productid)
The interviewer mentioned that we want to block the inventory of a product when createOrder
is called, and reduce the stock when confirmOrder
is called.
Candidate's Approach
The candidate initially created a cancelOrder
function to refill the inventory if an order was canceled. After some discussion, the candidate proposed using two variables: one for the fully available product count and another for the not yet confirmed but in-order product count. The interviewer was happy with this approach, but due to time constraints, the candidate could not implement the changes or run any test cases.
Interviewer's Feedback
The interviewer was happy with the overall low-level design (LLD) but suggested that the candidate could improve on clarifying requirements and time management.