two pointers
https://www.geeksforgeeks.org/container-with-most-water/
Approach :
- This implies that if there was a better solution possible, it will definitely have the Height greater than min(a1, aN).
- We know that, Base min(a1, aN)
This means that we can discard min(a1, aN) from our set and look to solve this problem again from the start. - If a1 < aN, then the problem reduces to solving the same thing for a2, aN.
- Else, it reduces to solving the same thing for a1, aN-1