Flipkart Machine coding round SDE2

flipkart logo
flipkart
SDE II
December 17, 20240 reads

Summary

I recently participated in a machine coding round for an SDE2 role at Flipkart, where I was tasked with building a comprehensive doctor-patient appointment booking system with several core functionalities and a waitlist feature.

Full Experience

During my machine coding round at Flipkart for the SDE2 position, I was presented with a detailed problem statement to develop a doctor-patient appointment booking application. The core challenge involved designing a system where doctors could register, declare their availability in 30-minute slots from 9 am to 9 pm, and patients could search for doctors by specialty, book appointments, and cancel them. A crucial aspect was implementing a waitlist feature: if a desired slot was booked, patients could join a waitlist, and the first person on the list would automatically get the slot if it became available. I also needed to implement a system for viewing booked appointments and a bonus feature to track trending doctors. The round had a time limit of 90 minutes, emphasizing modular, clean code, proper entity modeling, and extensibility, all while using only in-memory data structures.

Interview Questions (1)

Q1
Doctor-Patient Appointment Booking System (Machine Coding)
System DesignHard

We are required to build an app that lets patients connect to doctors and book appointments. The day is divided into time slots of 30 mins each, starting from 9 am to 9 pm. Doctors can login to the portal and declare their availability for the given day in terms of slots. Patients can login and book appointments/cancel existing appointments. For simplicity you can assume that the doctors’ availability is declared for that particular day only.

Functionalities required:

  • A new doctor should be able to register, and mention his/her speciality among (Cardiologist, Dermatologist, Orthopedic, General Physician)
  • A doctor should be able to declare his/her availability in each slot for the day. For example, the slots will be of 30 mins like 9am-9.30am, 9.30am-10am.
  • Patients should be able to login, and search available slots based on speciality.
  • The slots should be displayed in a ranked fashion. Default ranking strategy should be to rank by start time. But we should be able to plugin more strategies like Doctor’s rating etc in future.
  • Patients should be able to book appointments with a doctor for an available slot. A patient can book multiple appointments in a day. A patient cannot book two appointments with two different doctors in the same time slot.
  • Patients can also cancel an appointment, in which case that slot becomes available for someone else to book.
  • Build a waitlist feature: If the patient wishes to book a slot for a particular doctor that is already booked, then add this patient to the waitlist. If the patient with whom the appointment is booked originally, cancels the appointment, then the first in the waitlist gets the appointment.
  • A patient/doctor should be able to view his/her booked appointments for the day.

Bonus functionality:

  • Trending Doctor: Maintain at any point of time which doctor has the most appointments.

Guidelines:

  • Time: 90mins
  • Write modular and clean code.
  • A driver program/main class/test case is needed to test out the code by the evaluator with multiple test cases. But do not spend too much time in the input parsing. Keep it as simple as possible.
  • Evaluation criteria: Demoable & functionally correct code, Code readability, Proper Entity modelling, Modularity & Extensibility, Separation of concerns, Abstractions. Use design patterns wherever applicable.
  • You are not allowed to use any external databases like MySQL. Use only in memory data structures.
  • No need to create any UX.
  • Please focus on the Bonus Feature only after ensuring the required features are complete and demoable.
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!