← Questions

Penalty for shutting down a server from its uptime log

0
StripeCodingLast asked Sep 2023

A coding interview question asked in Stripe's onsite coding (debug, integrate, build) round, last asked Sep 2023. It tests prefix sums and arrays.

A server's log has one state per hour, separated by whitespace: 0 when the server was up and 1 when it was down. If the server is removed just before hour k, the penalty is the number of down hours before k (it should have been removed…

Sign in to unlock this question

The full prompt, the worked answer and your own canvas or code with the AI tutor. New accounts get 5 credits: each one unlocks a question for good.

Where it's asked

  • Stripe · Onsite coding: debug, integrate, build · Last asked Sep 202360 min · Project editor with starter code and tests: fix bugs in an unfamiliar codebase, wire an external API spec into a service, or complete a skeleton in parts · Varies by session: some onsites have one AI-assisted session and an integration session without AI

What it tests

prefix sums · arrays

Your code and the AI tutor open when you unlock this question.