FastPrepResource Allocation
Problems/Resource Allocation

Resource Allocation

Maven Securities logoMaven Securities● MediumINTERNOA

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: Reported in a Maven Securities intern online assessment. Our version is about 99% the same as the reported question.

There are two rows of storage units, storageA and storageB. Each unit contains a nonnegative number of resources, and 0 marks an empty unit.

Replace every 0 in both rows with a strictly positive integer so that the two row sums become equal.

Return the minimum equal total that can be achieved, or -1 if no such allocation is possible.

Function

minimumResources(storageA: int[], storageB: int[]) → int

Examples

Example 1

storageA = [1,2,0,4]storageB = [4,5,0,0,1]return = 12

Replace the zero in storageA with 5, producing [1,2,5,4]. Replace the two zeros in storageB with 1 each, producing [4,5,1,1,1]. Both rows then sum to 12, which is the minimum possible equal total.

Constraints

  • 1 <= storageA.length, storageB.length <= 10^5
  • 0 <= storageA[i], storageB[i] <= 10^4

More Maven Securities Online Assessment questions

  • Prime Factor VisitationOA · Seen Aug 2026

Similar questions at other companies

  • Minimum Rounds to Complete All TasksInfosys · OAInfosys interview questions
  • Minimize Adjacent Squared-Difference Cost with One InsertionMcKinsey & Company · OAMcKinsey & Company interview questions
  • Maximize Revenue from Decreasing InventoryChubb · OAChubb interview questions
  • Minimum Values with Even Powers of TwoVisa · OAVisa interview questions
  • Minimize Adjacent Squared-Difference Cost with One InsertionMicrosoft · OAMicrosoft interview questions
  • Minimum Halvings for Alternating ParityIBM · OAIBM interview questions
  • Rock JumpingIMC Trading · OAIMC Trading interview questions
  • Minimum Total Batch ExpenseAmazon · OA
  • Coprime Pick with Change CostCitadel · OACitadel interview questions
  • Minimum Increments for Stepwise TowersZipRecruiter · OAZipRecruiter interview questions
All Maven Securities interview questionsSee Maven Securities hiring insights
Saved
class Solution {
    public int minimumResources(int[] storageA, int[] storageB) {
        // Write your code here
    }
}
Checking account…