This is a classic dynamic programming problem.
通过观察面积公式,如果我们想让面积最大,就要让(right_index - left_index)由最大值向0收敛,并且尽可能地提高Min(height[left_index], height[right_index])的“短板”。
We can solve this problem in many ways.
This is a classic dynamic programming problem.
This is a classic dynamic programming problem.
We can solve this problem with dynamic programming or sliding window.