Two Pointers/Medium
Container With Most WaterPRO PASS
Time: O(N)Space: 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 / 176%
Solution Code
Custom Test Case Runner
Input your custom values and visualize step-by-step trace
Quick Presets:
AI DSA Coach
Contextual Tutor for Container With Most Water
Hello! I am your AI DSA Tutor for **Container With Most Water** (Two Pointers). Ask me anything about this algorithm, time complexity, or request a step hint!