FastPrepContainer With Most Water
Problems/Container With Most Water

Container With Most Water

EPAM logoEPAM● MediumFULLTIMEPHONE SCREEN

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: The named exercise gives the whole task. We chose the limits and the function signature. Our version is about 99% the same as the named exercise.

Given an array height, where height[i] is the height of a vertical line at position i, choose two lines that together with the horizontal axis form a container.

Return the maximum amount of water the container can hold. The area between indices left and right is (right - left) * min(height[left], height[right]).

Function

maxArea(height: int[]) → int

Examples

Example 1

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

Indices 1 and 8 have limiting height 7 and width 7.

Example 2

height = [1,1]return = 1

The only pair has width and height 1.

Constraints

  • 2 <= height.length <= 100000.
  • 0 <= height[i] <= 10000.
  • The maximum area fits in a signed 32-bit integer.

Source note: Author-written prompt excerpt retained for source fidelity.

More EPAM Phone Screen questions

  • Longest Palindromic SubstringPHONE SCREEN · Seen Oct 2026
  • Convert an Entry List to a MapPHONE SCREEN · Seen Oct 2026
  • Count Array Element FrequenciesPHONE SCREEN · Seen Oct 2026
  • Find First and Last Position of Element in Sorted ArrayPHONE SCREEN · Seen Oct 2026
  • Group AnagramsPHONE SCREEN · Seen Oct 2026
  • Longest Consecutive SequencePHONE SCREEN · Seen Oct 2026
  • Max Consecutive Ones IIIPHONE SCREEN · Seen Oct 2026
  • Minimum Currency ConversionsPHONE SCREEN · Seen Oct 2026
  • Next Greater Element IPHONE SCREEN · Seen Oct 2026
  • Partition and Group Values by ParityPHONE SCREEN · Seen Oct 2026

Similar questions at other companies

  • Container With Most WaterNuro · PHONE SCREENNuro 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 EPAM interview questionsSee EPAM hiring insights
Saved
class Solution {
    public int maxArea(int[] height) {
        // Write your code here.
    }
}
Checking account…