10 / 75
M

Container With Most Water

#10
arrayhashmap

Two-pointer: move the shorter line inward to try larger area.

Example:

Input:[1,8,6,2,5,4,8,3,7]
Output:49

Common Mistakes:

  • Off-by-one indexing
  • Not handling edge cases (null/empty)

Notes:

Edge cases: duplicates, empty inputs, negative numbers where applicable.

10/75
Container With Most Water