Subham Mohanty’s Post

LeetCode — Problem 11 | Day 2 💡 Problem: Container With Most Water Given an array of heights, find two lines that together form a container which holds the maximum water. 🧠 My Approach: - Used two pointers (start & end) - Calculated area using "min(height) * width" - Moved the pointer with smaller height to maximize area - Repeated until pointers meet This problem gave a good understanding of: ✔️ Two Pointer Technique ✔️ Optimizing from brute force to O(n) ✔️ Logical thinking in arrays #LeetCode #DSA #Java #CodingJourney

  • No alternative text description for this image

To view or add a comment, sign in

Explore content categories