Pattern 3 - Sorted Array Tricks

Techniques specific to sorted arrays.

Container With Most Water: Two pointers from ends. Move shorter line inward (taller can't help with shorter).

Trapping Rain Water: Water at ii = min(maxLeft,maxRight)height[i]\min(maxLeft, maxRight) - height[i]. Precompute or use two pointers.

Merge Sorted Arrays: Compare heads, take smaller. Advance that pointer.

Linked List Intersection: Sync lengths or switch heads at end.

All use sorted property or structural monotonicity to avoid nested loops.