Daily challenge for 2025-02-15
46. Container With Most Water
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]). Write a function solve that finds two lines that together with the x-axis forms a container, such that the container contains the most water.
Example:Input: [1,8,6,2,5,4,8,3,7]Output: 49
Explanation: The two vertical lines are drawn at x = 1 and x = 8, and together with the x-axis forms a container with an area of 49. You may want to check the relevant leetcode question for more information.
Run this challenge interactively in Python or JavaScript when the app loads.