FastPrepMinimum Buckets and Smallest Maximum Water Level
Problems/Minimum Buckets and Smallest Maximum Water Level

Minimum Buckets and Smallest Maximum Water Level

Google logoGoogle● MediumFULLTIMEPHONE SCREEN

Updated Sep 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: A Google MLE phone report asks to allocate y liters of infinitely divisible water among equal-capacity buckets: first minimize bucket count, then minimize the largest fill. A follow-up adds x liters that must be put in the first bucket, while keeping both goals. The source confirms the base count is ceil(y/capacity), but omits endpoint, zero-water, exact-first-bucket and output conventions. This practice requires at least x liters of added water in bucket 0, permits original water there too, and returns both optimal counts and maximum fills. The structured employment field was unmapped; FULLTIME is the explicit authoring default, not a claim about the candidate. Approximate source match: 83%.

Every bucket has the same positive capacity. You have originalWater liters of infinitely divisible water. First, use as few buckets as possible, then among those plans minimize the largest amount in any bucket.

In the follow-up, addedWater liters are added. All of the added water must be placed in bucket 0. Original water may also be placed in bucket 0; other buckets may contain only original water. Apply the same priorities: minimize the number of buckets first, then the largest fill. The added water is no more than one bucket capacity.

Return [baseCount, baseMinMax, followCount, followMinMax] as a double[]. Counts are exact integer-valued doubles. Maximum fills may be fractional; answers within relative or absolute error 1e-7 are accepted.

Function

minimumBucketPlan(capacity: int, originalWater: int, addedWater: int) → double[]

Examples

Example 1

capacity = 4originalWater = 5addedWater = 3return = [2.0,2.5,2.0,4.0]

Initially two buckets suffice and equal fills of 2.5 minimize the maximum. With eight liters total, two full buckets suffice; the first contains all three added liters plus one original liter.

Example 2

capacity = 10originalWater = 2addedWater = 9return = [1.0,2.0,2.0,9.0]

One bucket holds the original two liters. After adding nine liters, two buckets are needed. The first can hold the nine added liters and the second the original two, so the maximum is 9.

Example 3

capacity = 5originalWater = 1addedWater = 5return = [1.0,1.0,2.0,5.0]

The follow-up needs two buckets because the first is filled by the five added liters and the original liter goes elsewhere.

Constraints

  • 1 <= capacity <= 1000000.
  • 1 <= originalWater <= 1000000.
  • 0 <= addedWater <= capacity.
  • Water is infinitely divisible and may be allocated in arbitrary nonnegative real quantities without exceeding any bucket capacity.

More Google Phone Screen questions

  • Route Pattern MatcherPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Periodic-Color Binary Forest RootsPHONE SCREEN · Seen Nov 2026
  • Evaluate a Nested Math ExpressionPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Best Stock Trade with Buy and Sell DaysPHONE SCREEN · Seen Nov 2026
  • Word Chain Jumps in a GridPHONE SCREEN · Seen Nov 2026
  • Dice-Walk Winning ProbabilityPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Lowest Common Ancestor in an N-ary TreePHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Apartment Housemate PreferencesPHONE SCREEN · Seen Nov 2026
  • Price at Query TimestampsPHONE SCREEN · Seen Nov 2026
  • Course Schedule Cycle DetectionPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026

Similar questions at other companies

  • Sliding Window Attention over a KV CacheNVIDIA · PHONE SCREENNVIDIA interview questions
  • Integers With Multiple Sum of Two CubesCharta Health · PHONE SCREEN · ONSITE INTERVIEWCharta Health interview questions
  • Logistic Regression with Gradient DescentYahoo · PHONE SCREENYahoo interview questions
  • Evaluate an Arithmetic Expression Written in WordsBrex · PHONE SCREEN
  • Constant-Time Weighted Pick with an Alias TableEtched · PHONE SCREEN
  • Integer to English Words in USD and INR StylesVeeam · PHONE SCREEN
  • Adaptive Calibration ErrorOpenAI · PHONE SCREENOpenAI interview questions
  • Sum of Smallest Non-DivisorsThe D.E. Shaw Group · PHONE SCREENThe D.E. Shaw Group interview questions
  • Square Root FunctionCitadel · PHONE SCREENCitadel interview questions
  • Reorderable Task Scheduler With CooldownWaymo · PHONE SCREENWaymo interview questions

Google interview experiences

  • Google interviews · November 2026
  • Google Software Engineer Onsite Questions: 10 Experiences
  • Google OA: What It Tests (2026)
  • Google L4 SWE Phone Screen: 1 Experience
  • Google ML Engineering Manager Onsite: 1 Experience
  • Google Experienced SWE First Round and Onsite: 1 Experience
All Google interview questionsSee Google hiring insights
Saved
class Solution {
    public double[] minimumBucketPlan(int capacity, int originalWater, int addedWater) {
        // Write your code here.
    }
}
Checking account…