FastPrepContainer With Most Water
Problems/Container With Most Water

Container With Most Water

Nuro logoNuro● MediumFULLTIMEPHONE SCREEN

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: Reported in a Nuro phone screen for a full-time role. The report points to the well-known problem of finding the container that holds the most water. We kept the goal of the area between two lines.

You are given an integer array height of length n. There are n vertical lines drawn such that the two endpoints of the i-th line are (i, 0) and (i, height[i]).

Find two lines that, together with the x-axis, form a container so that the container holds the most water.

Return the maximum amount of water a container can store.

You may not slant the container.

Function

maxArea(height: int[]) → int

Examples

Example 1

height = [1,8,6,2,5,4,8,3,7]return = 49

The lines at indices 1 and 8 have heights 8 and 7. The width is 7, so the area is min(8, 7) * 7 = 49.

Example 2

height = [1,1]return = 1

The only pair forms a container of width 1 and height 1.

Constraints

  • 2 <= height.length <= 10^5.
  • 0 <= height[i] <= 10^4.

More Nuro interview questions

  • Merge Timestamped Record ListsPHONE SCREEN · Seen Oct 2026
  • Assign Robots to Their Nearest Available ItemsPHONE SCREEN · Seen Oct 2026
  • Course Ordering with Concurrent UpdatesPHONE SCREEN · Seen Sep 2026
  • Group Sparse Points by Distance ThresholdPHONE SCREEN · Seen Sep 2026
  • Reveal a Minesweeper RegionPHONE SCREEN · Seen Aug 2026
  • Schedule Buffered Video PlaybackPHONE SCREEN · Seen Aug 2026
  • Maximum Value for Two Delivery RobotsPHONE SCREEN · Seen Jul 2026
  • Thread-Safe Task Storage and Worker DispatchONSITE INTERVIEW · Seen Sep 2026
  • Trapping Rain WaterONSITE INTERVIEW · Seen Sep 2026
  • Versioned Key-Value Store with Suffix TruncationONSITE INTERVIEW · Seen Sep 2026

Similar questions at other companies

  • Container With Most WaterEPAM · PHONE SCREENEPAM interview questions
  • Rebalance Bank Accounts to a Minimum BalanceRemitly · PHONE SCREENRemitly interview questions
  • Container With Most WaterAmazon · PHONE SCREEN · ONSITE INTERVIEW
  • Container With Most WaterWayfair · PHONE SCREENWayfair interview questions
  • Container With Most WaterMastercard · PHONE SCREENMastercard interview questions
  • Assign CookiesExpedia · PHONE SCREEN · ONSITE INTERVIEWExpedia interview questions
  • Best Score Switching Between Two Sorted ArraysAdobe · PHONE SCREENAdobe interview questions
  • Maximum Easy Tasks After RearrangingIBM · OAIBM interview questions
  • Minimum Station Tracks for a Train ScheduleBNSF Railway · ONSITE INTERVIEWBNSF Railway interview questions
  • Latest Arrival to Catch a BusAutodesk · OAAutodesk interview questions
All Nuro interview questionsSee Nuro hiring insights
Saved
class Solution {
    public int maxArea(int[] height) {
      // Write your code here.
    }
}
Checking account…