Two Pointers · Medium
Container With Most Water
O(N) · O(1)
Initialize Two Pointers
Array is sorted. Set left pointer L=0 (val 1) and right pointer R=8 (val 7).
Array Elements & Pointers
L ↓
1
L8
[1]6
[2]2
[3]5
[4]4
[5]8
[6]3
[7]R ↓
7
RLive Variables & Invariants
target:9
left:0
right:8
sum:8
Step 1 / 17
6%
Solution Code
LeetCode IDE Console
Test Cases
3 cases from Blind 75 & NeetCode 150
Ask for a hint whenever you get stuck.