Efficient Deployments
Updated
Problem statement
A supercomputer has n processors arranged in a row. Processors are deployed one at a time in any order.
For processor i, its efficiency is:
no_adjacent[i]when neither adjacent processor was deployed earlier,one_adjacent[i]when exactly one adjacent processor was deployed earlier,both_adjacent[i]when both adjacent processors were deployed earlier.
The first and last processors have only one adjacent processor. Return the maximum total efficiency over all deployment orders.
Function
getMaximumSum(no_adjacent: int[], one_adjacent: int[], both_adjacent: int[]) → longExamples
Example 1
no_adjacent = [1, 2, 3, 4]one_adjacent = [4, 4, 2, 1]both_adjacent = [0, 1, 1, 0]return = 14Deploy processors in the order 4 -> 3 -> 2 -> 1. Their efficiencies are 4, 2, 4, and 4, for a total of 14.
The older source rendering lists 13, but its displayed addition substitutes 3 for one_adjacent[3] = 2. Applying the stated rules and arrays gives 14.
Constraints
2 <= n <= 10^5no_adjacent.length == one_adjacent.length == both_adjacent.length == n1 <= no_adjacent[i], one_adjacent[i], both_adjacent[i] <= 10^9
More Snowflake Online Assessment questions
- Safest Shortest Path Through a GridOA · Seen Nov 2026
- Find Valid SET Card TriplesOA · PHONE SCREEN · Seen Nov 2026
- LFU CacheOA · ONSITE INTERVIEW · Seen Nov 2026
- Minimum Index Distance Between Person and CakeOA · PHONE SCREEN · Seen Nov 2026
- Minimum N-ary Tree Depth DeletionsOA · PHONE SCREEN · Seen Nov 2026
- Sum of Binary Tree Boundary NodesOA · PHONE SCREEN · Seen Nov 2026
- Optimal TransferOA · Seen Oct 2026
- Generating Login CodesOA · Seen Sep 2026
- String Formation (Also for AI/ML Software Engineer Intern :)OA · Seen Sep 2026
- Minimum Clicks Between Wiki PagesOA · PHONE SCREEN · Seen Sep 2026
Similar questions at other companies
- At Most K Jumps with Quadratic Transition CostInfosys · OAInfosys interview questions
- Largest Consistent Visiting GroupAuxoAI · OA
- Delete K Subsets for Maximum ScoreRubrik · OARubrik interview questions
- Optimize Discount Selection Under a Point BudgetPalantir · OAPalantir interview questions
- Maximum Index-Weighted Sum with Disjoint SwapsVisa · OAVisa interview questions
- Maximum Sum of HeightsVirtu Financial · OAVirtu Financial interview questions
- Pressure-Isolation Shutdown OrderIntuit · OAIntuit interview questions
- Get Minimum IncrementIBM · OAIBM interview questions
- Jump Game with Prime-3 StepsUber · OAUber interview questions
- Maximum Payout with Context SwitchesPhonePe · OAPhonePe interview questions