Acko | SDE-2 | LLD - MC | Onsite Interview

Anonymous User
667
Feb 01, 2025
Feb 02, 2025

Round 1: Machine Coding

Design a Garage Recommendation System:

A. User Functionality:

Users should be able to onboard new garages into the system.
Users should be able to initiate a repair request.
Users should be able to mark a repair as completed.
Users should be able to provide a rating for the service.

B. Recommendation API expectation:

Given a user's location as API input, the system should recommend the best garages based on proximity, average repair cost, average turnaround time (TAT), and user ratings.
The selection is optimized using a scoring function:
Score = 0.33 × Avg Cost + 0.3 × TAT + 0.3 × Avg Rating.

Experience:

  1. Mistake done: Added Cost component in Garage. Interviewer told it should be in Repair/Vehicle. It was noted down as Hint given.
  2. Asked to "Keep it Simple and Stupid"
  3. He expected more in the API recommendation part. But I was giving simple priority queue. Didn’t read the question properly. Based on the inputted location, I have to give recommendation. Missed that part.
  4. He told computing score everytime for every customer is not good. Have the recommendation handy and simply return when the customer asks. Should have given the answer in GeoMap (latitude - longitude map)
  5. Taken too much time in the Entity part itself. Should have done better

Verdict: Rejected

Good experience. Onsite interview process was nice and smooth.

My Schema Design:


Pair
Attributes:
Double value
Integer id
Functions:
Pair(Double value, int id)

CustomeException
Attributes: None
Functions:
CustomeException(String msg)

GarageManagementSystem
Attributes:
GarageManagementSystem instance
Map<Integer, Garage> listOfGarage
Functions:
List<Integer> getGarageLocation()  // Written PriorityQueue logic to get the top 10 garages recommendation in this function
void setInitialGarages(int numberOfGarages)
static GarageManagementSystem getInstance()

Vehicle
Attributes:
String vehicleId
String vehicleOwnerName
String registrationNumber
Functions:
Vehicle(String vehicleId, String vehicleOwnerName)
Vehicle(String vehicleId, String vehicleOwnerName, String registrationNumber)

Repair
Attributes:
String repairId
Vehicle vehicle
double cost
LocalDateTime repairStartTime
LocalDateTime repairEndTime
LocalDateTime totalRepairTime
int ratings
RepairStatus repairStatus
Functions:
Repair(String repairId, Vehicle vehicle)
void setRepairEndTime()
long getTotalRepairTime()
void completeRepair()

Garage
Attributes:
int garageId
String location
List<Repair> repairsList
Functions:
Garage(int id)
double getAverageCost()
long getAverageRepairTime()
double getAverageRating()
Comments (2)