Flipkart Machine Coding Round

Anonymous User
2448
Apr 04, 2025

Fliplart Machine Coding Round Problem Statement

Sample Problem for Machine Coding Rounds

Feed.Me: Food ordering system Time: 90mins
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:
  6. Onboard a new restaurant.
  7. A restaurant should be able to update its menu. For simplicity, a restaurant can't delete
    an item from the menu.
  8. Restaurants can mark ACCEPTED orders as COMPLETED. Orders once ACCEPTED
    can’t be CANCELLED by a restaurant.
  9. A customer should be able to place an order by giving items, respective quantities &
    selection criteria.
  10. Order will be auto-assigned to a restaurant based on a selection criteria. 6. Implement all the restaurant selection criteria.
  11. Bonus Requirement: Restaurant should be able to update Capacity.
  12. 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:
  13. Make sure that you have working and demoable & functionally correct code.
  14. Use proper abstractions, separation of concerns, proper entity modeling
  15. Use appropriate design patterns wherever required.
  16. The code should be modular, extensible, readable and unit-testable.
  17. Proper exception handling is required.
  18. Restaurant selection criteria must be extensible.
  19. 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}

  1. Place Order
    Order1
    Input: { user: Ashwin, items: [ 3Idli, 1Dosa ], selection: Lowest cost }
    Output: Order assigned to R3

Order2.
Input: { user: Harish, items: [ 3Idli, 1Dosa ], 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

Update Order Status:
R3 marks Order1 as COMPLETED

Order4:
Input: { user: Harish, items: [ 3Idli, 1Dosa ], selection: Lowest cost }
Output: Order assigned to R3 (since R3 has COMPLETED Order1)

Order5:
Input: {user: xyz, items: [1Paneer Tikka, 1Idli], selection: ‘Lowest cost}
Output: Order can’t be fulfilled (since none of the restaurants above serve Paneer Tikka)

Comments (2)