FastPrepCircular Server Scheduling with Recovery
Problems/Circular Server Scheduling with Recovery

Circular Server Scheduling with Recovery

ZipRecruiter logoZipRecruiter● MediumNEW GRADOA

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: A ZipRecruiter new-grad OA report describes cyclic servers, REQUEST rotation, work limits and recovery for each server, UP wake commands, and returning the busiest server. We supplied time measured by command index, skip and drop behavior, resets, zero-based IDs, and ties going to the smallest ID. Our version is about 78% the same as the reported question.

Servers 0 through serverCount - 1 are cyclic. Command index is its time. Maintain a pointer initially before server 0.

  • REQUEST scans cyclically after the pointer for the first server available at this time. That server processes the request and becomes the pointer. If none is available, drop the request.
  • After a server processes workLimit requests since its last wake, it is unavailable for the next recoveryTime command times; its work counter resets when recovery finishes.
  • UP i immediately makes server i available and resets its work counter; the pointer does not move.

Return the smallest server ID among those processing the most requests.

Function

busiestServer(serverCount: int, workLimit: int, recoveryTime: int, commands: String[]) → int

Examples

Example 1

serverCount = 3workLimit = 5recoveryTime = 2commands = ["REQUEST","REQUEST","REQUEST","REQUEST"]return = 0

Available servers receive requests cyclically.

Example 2

serverCount = 2workLimit = 1recoveryTime = 2commands = ["REQUEST","REQUEST","REQUEST","REQUEST"]return = 0

Servers become available after their recovery windows.

Constraints

  • 1 <= serverCount, workLimit <= 1000
  • 0 <= recoveryTime <= 100000
  • 1 <= commands.length <= 100000

More ZipRecruiter Online Assessment questions

  • Four-Level Banking System with Scheduled PaymentsOA · Seen Oct 2026
  • Count Three-Digit Numbers with Distinct DigitsOA · Seen Oct 2024
  • Longest Frequency-Bounded SubarrayOA · Seen Oct 2024
  • Minimum Changes to Draw a YOA · Seen Oct 2024
  • Apply Binary State OperationsOA · Seen Sep 2024
  • Simulate Orchard Rot SpreadOA · Seen Sep 2024
  • Compare Odd- and Even-Index SumsOA · Seen Sep 2024
  • Coordinate Removals with Column GravityOA · Seen Sep 2024
  • Lexicographically Smallest End ReversalOA · Seen Sep 2024
  • Recursively Expanded Shell Command CountsOA · Seen Sep 2024

Similar questions at other companies

  • Realized PnL with Oldest Inventory FirstBelvedere Trading · OA
  • Buffet Day GainsUpstart · OAUpstart interview questions
  • Busy IntersectionCitadel · OACitadel interview questions
  • Per-Client Sliding-Window Rate LimiterGeneral Motors · OA
  • Bank Requests with Delayed CashbackRamp · OARamp interview questions
  • Find Requests in QueueAmazon · OA
  • Key-Value Locks with Waiting QueuesKlaviyo · OAKlaviyo interview questions
  • Customer Checkout DurationOptiver · OAOptiver interview questions
  • Get Potential of Winner 🏆IBM · OAIBM interview questions
  • Busy IntersectionIMC Trading · OAIMC Trading interview questions

ZipRecruiter interview experiences

  • ZipRecruiter SWE OA, Level Not Reported: 23 Experiences
  • ZipRecruiter SWE Intern OA Scores: 4 Experiences
  • ZipRecruiter SWE New Grad OA: 9 Experiences
All ZipRecruiter interview questionsSee ZipRecruiter hiring insights
Saved
class Solution {
    public int busiestServer(int serverCount, int workLimit, int recoveryTime, String[] commands) {
        // Write your code here.
    }

}
Checking account…