PhonePe Machine Coding Round [ exp 1.7 years Backend Developer]
Company: PhonePe
Role: software engineer 1
Interview Stage: Phone Screen
Location: unknown
Year: unknown
Original Post Content:
Recently attended PhonePe Machine Coding Round
YoE: 1.7 years
Round Number: 1
Question: Write modular, Structured and Scalable Working Code for ECommerce application (buyers side heavy)
Language: Java / C++
Time Constraint: 2 hours
IDE: Choose on your own.
Requirements: User authentication, Catalog creation, Checkout, OrderManagement and some minor other requirements
Result: Proceeding for next round.
I built all the functionality using design patterns like template method, strategy, singleton, builder and somewhat bridge pattern. I was not able to complete whole functionality because of time constraints.
Followed by this, there was a 1/2 hour review interview round, in which interviewers dug down into the core logic of implementation and gave some challenging scenario of managing locking in inventory in a distributed system of such an e-commerce application.
The exact follow-up question was: how will you lock a quantity of 10 Pens in inventory in a distributed environment.
My answer: I suggested to use Redis sorted set to store timestamp whenever there is a checkout on a product. If 6 products are in checkout state, add 6 timestamps in Redis sorted set and expire them after 5 minutes to allow others to perform checkout.
Remark: Interviewer did not focus on if I was able to complete my assignment in whole; he was curious about challenges we could solve related to that scenario if given.