Rippling SDE-2 Phone Screening – Interview Question
Anonymous User
4525

Rippling SDE-2 Phone Screening – Interview Question

About Me

Experience: 1.9 years
Current Desgination : SWE-1
Process : Reffered for SDE-2 , then shifted for SDE-1 , gave online assesment then , had a call with recutrier then they considered my profile for SDE-2.

Part 1 – Basic Implementation

Problem Statement:
We are given a list of drivers and the deliveries they are making. Implement a service to compute the total cost of all deliveries. The service should expose three methods:

  1. addDriver(driverId)
  2. addDelivery(startTime, endTime)
  3. getTotalCost()

Key Points:

  • getTotalCost() needed to run in optimized time.
  • I optimized by computing and maintaining the total cost at the time of adding the delivery (instead of recalculating each time getTotalCost() is called).

Result:

  • The interviewer tested against custom test cases → all passed.
  • He confirmed my optimization approach was valid.

Part 2 – Payment Functionality

New Requirements:
Add two new functionalities:

  1. payUpToTime(upToTime) → settle the delivery cost up to this time.
  2. getCostToBePaid() → get the remaining delivery costs left after settling the payment.

My Approach:

  • I used a global priority queue with time represented as epochs and estimated cost for the same , once the function is called we kind of get all drivers entries and subract the money from total cost to get totalcosttobepaid
    • Then:

      costToBePaid = totalCost - paidCost

Result:

  • Interviewer agreed with the approach.
  • Implemented the code.
  • Tested with interviewer’s test cases → all worked as expected.

Takeaway:

  • Optimized getTotalCost by precomputing on insertion.
  • was able to explain everything , waiting for results
  • Interveiwer mentoined that he want to look into oops and extensbility , I was able to explain him clearly , what all my thoughts are
  • Interveiwer was really satidifed with my detailed introduction he did mention it 2-3 times the same.

Comments (4)