Container With Most Water - LeetCode
You are given an integer array height of length n. There are n vertical lines drawn such that the two endpoints of the ith line are (i, 0) and (i, height[i]). Find two lines that together with the x-axis form a container, such that the container contains the most water. Return the maximum amount of water a container can store. Notice that you may not slant the container. Example 1: Example 2: Constraints: 1. Please don't post any solutions in this discussion. 2. The problem discussion is for asking questions about the problem or for sharing tips - anything except for solutions. 3. If you'd like to share your solution for feedback and ideas, please head to the solutions tab and post it there. The current formulation of the problem doesn't make any sense. After having seen the solution, I've found the following clarification to be needed: Forget about water; that only confuses things. The problem is just about finding a maximum area rectangle. The water formulation made me think that for
You are given an integer array height of length n. There are n vertical lines drawn such that the two endpoints of the ith line are (i, 0) and (i, height[i]). Find two lines that together with the x-axis form a container, such that the container contains the most water. Return the maximum amount of water a container can store. Notice that you may not slant the container. Example 1: Example 2: Constraints: 1. Please don't post any solutions in this discussion. 2. The problem discussion is for asking questions about the problem or for sharing tips - anything except for solutions. 3. If you'd lik
Explore this link on the map →