Stack Bash - Master data structures and algorithms

Container with most water

You're given an array of non-negative integers that represent various possible heights of a container.
Find the max area of a container, where:
  1. The width is the distance between the numbers in the input array
  2. And the height is the largest possible height on both sides of the contianer.
For example, given the heights [3, 9, 2, 7, 4, 6], the max container area is 24, shown by the shaded area below:
Container with most water example

Try it


6 Essential Arrays Coding Interview Problems

Master Arrays by trying the coding challenges below.
  1. 1.Trade stock onceEasy
  2. 2.AdditionEasy
  3. 3.Find the smallestEasy
  4. 4.Reorganize numbersHard
  5. 5.Maximum subarrayHard
  6. 6.Container of waterHard

Want to confidently pass your next coding interview?

Stack Bash helps new and veteran software engineers master data structures and algorithms for technical interviews.