FastPrepBabysitter Quote with Hourly Rates
Problems/Babysitter Quote with Hourly Rates

Babysitter Quote with Hourly Rates

Upstart logoUpstart● MediumFULLTIMEONSITE INTERVIEW

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: The report asks for a runnable babysitter quote with different hourly pay and edge cases. The daily schedule, minute units, overnight convention and final rounding are explicit practice definitions. Approximate source match: 65%.

Calculate a babysitter quote when the hourly pay changes with the time of day.

For this exercise, assume hourlyRates has exactly twenty-four entries. Entry h is the hourly rate in cents from hour h up to, but not including, hour h + 1. This daily schedule repeats at midnight. The start and end are integer minutes after midnight.

Charge from startMinute up to, but not including, endMinute, written [startMinute, endMinute). If the end is earlier than the start, the end is on the next day. Equal endpoints mean a zero-length booking, not a full day. Each billed minute costs one-sixtieth of the hourly rate for that minute. Add these charges without rounding them separately. Then round the total up to a whole cent, once. Return that integer number of cents.

These time, overnight, proration and rounding rules are the complete pricing rules; no additional fees, minimum booking or discounts apply.

Function

babysitterQuote(startMinute: int, endMinute: int, hourlyRates: int[]) → int

Examples

Example 1

startMinute = 60endMinute = 120hourlyRates = [1200,1200,1200,1200,1200,1200,1200,1200,1200,1200,1200,1200,1200,1200,1200,1200,1200,1200,1200,1200,1200,1200,1200,1200]return = 1200

One whole hour at a flat rate.

Example 2

startMinute = 450endMinute = 510hourlyRates = [600,600,600,600,600,600,600,600,1200,1200,1200,1200,1200,1200,1200,1200,1800,1800,1800,1800,1800,1800,1800,1800]return = 900

A quote straddles an hourly rate change.

Example 3

startMinute = 1410endMinute = 30hourlyRates = [600,600,600,600,600,600,600,600,1200,1200,1200,1200,1200,1200,1200,1200,1800,1800,1800,1800,1800,1800,1800,1800]return = 1200

One hour across midnight at different rates.

Constraints

  • 0 <= startMinute, endMinute < 1440.
  • hourlyRates.length = 24.
  • 0 <= hourlyRates[h] <= 10000 cents per hour.
  • The booking lasts from zero through 1439 whole minutes.
  • All weighted sums and the returned quote fit a signed 32-bit integer.

More Upstart interview questions

  • Maximum SubarrayONSITE INTERVIEW · Seen Oct 2026
  • Buffet Day GainsOA · Seen Sep 2026
  • Case-Insensitive Anagram CheckOA · Seen Sep 2026
  • Filter Duplicates While Preserving OrderOA · Seen Sep 2026
  • Scale Ingredient QuantitiesOA · Seen Sep 2026
  • ABO Parent Genotype CombinationsOA · Seen Aug 2026
  • Chunked Byte Stream ChecksumsOA · Seen Aug 2026
  • Cluster Size on DiskOA · Seen Aug 2026
  • Double Substitution DecryptionOA · Seen Aug 2026
  • Add Drama to Text GroupsOA · Seen Jul 2026

Similar questions at other companies

  • Finish Time of Fixed-Length CPU TasksGoogle · PHONE SCREEN · ONSITE INTERVIEWGoogle interview questions
  • Online Meeting Scheduler with Fixed RoomsUber · ONSITE INTERVIEWUber interview questions
  • Delivery Cost TrackerRippling · PHONE SCREEN · ONSITE INTERVIEWRippling interview questions
  • Expected Value of Modified DiceJane Street · ONSITE INTERVIEWJane Street interview questions
  • Fractional Share Inventory FlatteningRobinhood · PHONE SCREEN · ONSITE INTERVIEWRobinhood interview questions
  • Reservoir Sampling with Recorded DrawsMeta · ONSITE INTERVIEWMeta interview questions
  • Group-Relative Policy AdvantagesAmazon · ONSITE INTERVIEW
  • Reservoir Sampling with Recorded DrawsStackAdapt · ONSITE INTERVIEWStackAdapt interview questions
  • Iterate Canonical IPv6 AddressesOpenAI · ONSITE INTERVIEWOpenAI interview questions
  • UCB1 Multi-Armed Bandit TraceWayfair · ONSITE INTERVIEWWayfair interview questions
All Upstart interview questionsSee Upstart hiring insights
Saved
class Solution {
    public int babysitterQuote(int startMinute, int endMinute, int[] hourlyRates) {
        // Write your code here.
    }
}
Checking account…