10 / 75
Two-pointer: move the shorter line inward to try larger area.
Example:
Input:
[1,8,6,2,5,4,8,3,7]Output:
49Common Mistakes:
- Off-by-one indexing
- Not handling edge cases (null/empty)
Notes:
Edge cases: duplicates, empty inputs, negative numbers where applicable.
💻
Java Solution Hidden
Enable “Show Full Solution” to view the code
Two-pointer: move the shorter line inward to try larger area.
Example:
Input:
[1,8,6,2,5,4,8,3,7]Output:
49Common 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