Server Upgrade Planning
Reported by candidates from Rippling's online assessment. Pattern, common pitfall, and the honest play if you blank under the timer.
With t1 and t2 up to 10^9, simulating second by second is dead on arrival, and that's the whole point of this Rippling OA question, reported in July 2026. Two servers, one upgrade per second, each blocked on multiples of its own request interval. You need the smallest total time T that fits both jobs. The pattern is binary search on the answer with a counting check. If you blank on the feasibility formula during the assessment, StealthCoder runs invisibly as a safety net and can hand you the working approach.
The problem
Two servers require t1 and t2 seconds of upgrade work. During each numbered second, at most one server can undergo an upgrade. The first server receives requests at every multiple of req1 and cannot be upgraded during those seconds. The second server receives requests at every multiple of req2 and cannot be upgraded during those seconds. There may be seconds during which neither server is upgraded. Return the minimum total number of seconds needed to complete both upgrades. Function getMinUpgradationTime(req1: int, t1: int, req2: int, t2: int) → long Examples Example 1 req1 = 2 t1 = 3 req2 = 3 t2 = 1 return = 5 Upgrade the first server during seconds 1, 3, and 5. Upgrade the second server during second 2. Each chosen second avoids that server's request multiples, so both upgrades finish after 5 seconds. Example 2 req1 = 2 t1 = 1 req2 = 2 t2 = 3 return = 7 Neither server can be upgraded during an even-numbered second. Four one-second upgrade slots are needed, so the earliest usable slots are 1, 3, 5, and 7. Constraints 2 <= req1, req2 <= 3 * 10^4 1 <= t1, t2 <= 10^9
Reported by candidates. Source: FastPrep
Pattern and pitfall
Binary search on T. For a given T, check feasibility with counting. Server 1 can use T - floor(T/req1) seconds. Server 2 can use T - floor(T/req2). Seconds blocked for both are multiples of lcm(req1, req2), so the union of usable seconds is T - floor(T/lcm). Feasible if free1 >= t1, free2 >= t2, and the union of usable seconds >= t1 + t2. That last check is inclusion-exclusion on the shared pool. The pitfall is forgetting the combined condition and only checking each server alone, which gives answers that are too small. Another trap is overflow: the upper bound can reach around 2*10^9 times a factor, so use 64-bit and set hi generously, like 4*10^18 safe-capped or (t1+t2)*2*max(req). Compute lcm in 64-bit. If the live OA goes sideways, StealthCoder is the hedge that reads the problem and gives you the check function.
If you see this problem in your OA tomorrow, the play is to recognize the pattern in 30 seconds. StealthCoder buys you that recognition.
You can drill Server Upgrade Planning cold, or you can hedge it. StealthCoder runs invisibly during screen share and surfaces a working solution in under 2 seconds. The proctor sees the IDE. They don't see what's behind it. Built by an Amazon engineer who passed his OA cold and still thinks the filter is broken.
Get StealthCoderRelated leaked OAs
You've seen the question.
Make sure you actually pass Rippling's OA.
Rippling reuses patterns across OAs. Built by an Amazon engineer who passed his OA cold and still thinks the filter is broken. Works on HackerRank, CodeSignal, CoderPad, and Karat.
Server Upgrade Planning FAQ
What's the trick in Server Upgrade Planning?+
Binary search on the total time T. The feasibility check is pure arithmetic: count seconds usable by each server with floor division, then make sure the combined usable seconds cover t1 + t2. No simulation needed.
Why can't I just simulate each second?+
t1 and t2 go up to 10^9, so the answer can be in the billions of seconds. Looping through each one is too slow. Binary search with an O(1) check takes about 60 iterations.
How do I handle seconds blocked for both servers?+
Those are multiples of lcm(req1, req2). Seconds usable by at least one server equal T minus floor(T/lcm). That total must be at least t1 + t2, alongside each server's own count meeting its need.
What edge cases break solutions?+
Integer overflow in the lcm and in the upper bound is the big one. Use 64-bit everywhere. Also check Example 2, where both req values are 2 and the lcm equals 2, so only odd seconds count and the answer is 7.
How should I prep in 48 hours for this Rippling OA?+
Write a binary-search-on-answer template and practice two or three counting checks with floor division and lcm. Run both examples by hand: 5 and 7. Then test large values to confirm no overflow.