Yahoo India Web Search

Search results

  1. class Solution {public: int maxArea (vector < int >& height) {int ans = 0; int l = 0; int r = height. size ()-1; while (l < r) {const int minHeight = min (height [l], height [r]); ans = max (ans, minHeight * (r-l)); if (height [l] < height [r]) ++ l; else--r;} return ans;}};

  2. Problem. 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.

  3. Container With Most Water LeetCode Solution - given array height of length n, Return the maximum amount of water a container can store.

  4. 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: Input: height = [1,8,6,2,5,4,8,3,7] Output: 49.

  5. Feb 17, 2021 · Find two lines, which, together with the x-axis forms a container, such that the container contains the most water. Notice that you may not slant the container. Examples: Example 1: Input: height = [1,8,6,2,5,4,8,3,7] Output: 49.

  6. Mar 30, 2022 · This article will cover and explain a solution to Leetcode 11, Container With Most Water. Problem Overview. You are given an integer array height of length n. There are n vertical lines...

  7. Sep 10, 2023 · 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.

  8. Nov 19, 2022 · 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.

  9. Can you solve this real interview question? Container With Most Water - Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview.

  10. Jul 26, 2021 · Find two lines, which, together with the x-axis forms a container, such that the container contains the most water. Notice that you may not slant the container. Solution: Time Complexity : O(n) Space Complexity: O(1)

  1. People also search for