Flipkart Machine Coding Round

flipkart logo
flipkart
· Ongoing
April 4, 2025 · 102 reads

Summary

I faced a challenging machine coding round at Flipkart where I was tasked with designing and implementing an online food ordering system called 'Feed.Me' within 90 minutes.

Full Experience

During my interview process for Flipkart, I was given a machine coding challenge that required me to build an online food ordering system, which they named 'Feed.Me'. I had 90 minutes to implement the system, focusing on key features such as restaurant management, menu updates, order placement, and an intelligent auto-assignment mechanism based on various criteria like lowest cost or highest rating. The problem emphasized handling concurrent orders, managing restaurant capacity, and ensuring the code was modular, extensible, and well-tested using an in-memory store. I also had to consider several bonus requirements, like updating restaurant capacity and adding new selection criteria.

Interview Questions (1)

1.

Feed.Me: Food Ordering System Machine Coding

System Design·Hard

Description:

Implement an online food ordering system. Features:

  1. This food processing system has a tie-up with restaurants where each restaurant has a menu with all the items & their prices. Restaurants also have a rating out of 5.
  2. Each restaurant has max #orders it can process at any given time. Beyond that, it shouldn’t be assigned any further orders until an ongoing order is completed.
  3. Once an order is ACCEPTED, the restaurant can mark it as COMPLETED when the order is ready. This will free up the processing capacity of the restaurant. A restaurant can’t CANCEL an ACCEPTED order.
  4. An order will be auto-assigned to a restaurant by the food processing system based on a criteria. Eg: Assign by lowest cost or best rating. This criteria will be given as input to the food processing system by the customer.
  5. An order will be auto-assigned to a restaurant only if all the items in an order can be fulfilled by a single restaurant. Else the order will not be ACCEPTED.

Requirement:

  1. Onboard a new restaurant.
  2. A restaurant should be able to update its menu. For simplicity, a restaurant can't delete an item from the menu.
  3. Restaurants can mark ACCEPTED orders as COMPLETED. Orders once ACCEPTED can’t be CANCELLED by a restaurant.
  4. A customer should be able to place an order by giving items, respective quantities & selection criteria.
  5. Order will be auto-assigned to a restaurant based on a selection criteria.
  6. Implement all the restaurant selection criteria.
  7. Bonus Requirement: Restaurant should be able to update Capacity.
  8. Bonus Requirement: Add one more selection criteria - remaining maximum capacity available for a restaurant. The restaurant with max remaining capacity should process the order.

Note: Do not use any database or NoSQL store, use an in-memory store.

Expectation:

  1. Make sure that you have working and demoable & functionally correct code.
  2. Use proper abstractions, separation of concerns, proper entity modeling.
  3. Use appropriate design patterns wherever required.
  4. The code should be modular, extensible, readable and unit-testable.
  5. Proper exception handling is required.
  6. Restaurant selection criteria must be extensible.
  7. Concurrency handling (BONUS / Good to have)

Sample test cases:

  1. Onboard Restaurants
    • R1: “max_orders_that_can_be_processed_at_a_time” : 5, “Menu”: [“Veg Biryani” : Rs.100, “Chicken Biryani”: Rs.150], “rating”: 4.5/5
    • R2: “max_orders_that_can_be_processed_at_a_time”: 5, menu: [“Chicken Biryani” : Rs.175, “Idli” : Rs.10, “Dosa” : Rs.50, “Veg Biryani” : Rs. 80], “rating”: 4/5
    • R3: “max_orders_that_can_be_processed_at_a_time”: 1, “menu”: [“Gobi Manchurian” : Rs.150, “Idli” : Rs.15, “Chicken Biryani” : Rs.175, “Dosa”: Rs.30 ], “rating”: 4.9/5
  2. Update restaurant menu
    • ADD: {Restaurant_1, add, Chicken65, Rs.250}
    • UPDATE: {Restaurant_2, update, Chicken Biryani, Rs.150}
  3. Place Order
    • Order1: Input: { user: Ashwin, items: [ 3*Idli, 1*Dosa ], selection: Lowest cost } Output: Order assigned to R3
    • Order2: Input: { user: Harish, items: [ 3*Idli, 1*Dosa ], selection: Lowest cost } Output: Order assigned to R2 (Not R3 since it has reached its full capacity from Order1)
    • Order3: Input: { user: Shruthi, items: [3*Veg Biryani], selection: ‘Highest rating’ } Output: Order assigned to R1
  4. Update Order Status: R3 marks Order1 as COMPLETED
  5. Order4: Input: { user: Harish, items: [ 3*Idli, 1*Dosa ], selection: Lowest cost } Output: Order assigned to R3 (since R3 has COMPLETED Order1)
  6. Order5: Input: {user: xyz, items: [1*Paneer Tikka, 1*Idli], selection: ‘Lowest cost} Output: Order can’t be fulfilled (since none of the restaurants above serve Paneer Tikka)
Discussion (0)

Share your thoughts and ask questions

Join the Discussion

Sign in with Google to share your thoughts and ask questions

No comments yet

Be the first to share your thoughts and start the discussion!