Files
dsa-competitive-programming/leetcode/lc11/notes.md
T
2026-01-29 01:04:37 +05:30

602 B

My initial intuition was to find the largest element and expand on either side of it to find the next farthest and largest element. But as it turns out, answer doesnt depend on largest element at all.

The update part for left and right depend on the fact that there is a "possibility" that we will get a bigger area with the taller height, it is important to assert that there cannot be a bigger area in between the two points that contains the lower pointer's point. This fact is what allows us to "ignore" any other combination with the lower point and shift the lower pointer closer to the middle.