Server Upgrade Planning
Updated
Problem statement
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) → longExamples
Example 1
req1 = 2t1 = 3req2 = 3t2 = 1return = 5Upgrade 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 = 2t1 = 1req2 = 2t2 = 3return = 7Neither 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^41 <= t1, t2 <= 10^9
More Wells Fargo Online Assessment questions
- Student and Course EnrollmentOA · Seen Nov 2026
- Bond Interest Summary Above 3%OA · Seen Oct 2026
- Count Phrases Formed by Anagram ReplacementOA · Seen Oct 2026
- Event Statistics AggregatorOA · Seen Sep 2026
- Ordered Deployment Configuration ValidatorOA · Seen Sep 2026
- Longest Subsequence That Is a SubstringOA · Seen Jul 2026
- Overloaded Game Account InventoriesOA · Seen Jul 2026
- Count Server ReplacementsOA · PHONE SCREEN · Seen Feb 2026
- Minimum Remaining LengthOA · PHONE SCREEN · Seen Feb 2026
- High Resource Usage CustomersOA · Seen Nov 2025
Similar questions at other companies
- Rock JumpingIMC Trading · OAIMC Trading interview questions
- Server Upgrade PlanningRippling · OARippling interview questions
- Minimum Full Glasses for an Exact Water VolumeMarshall Wace · PHONE SCREENMarshall Wace interview questions
- Maximum Supplier ProfitExpedia · ONSITE INTERVIEWExpedia interview questions
- Minimum Rounds to Complete All TasksInfosys · OAInfosys interview questions
- Find Minimum TimeAlphaSense · OA
- Find Minimum TimeBlackRock · OABlackRock interview questions
- Task Scheduler with CooldownGoDaddy · OA
- Maximize Pipeline Throughput Under a Scaling BudgetMicrosoft · OAMicrosoft interview questions
- Perfect Squares Matching a PatternNielsen · OA