Back to Browse

Container With Most Water | Leetcode Problem 11 | C++ Solution

414 views
Nov 22, 2023
11:20

Problem Name : Container With Most Water Problem Link : https://leetcode.com/problems/container-with-most-water/ Problem Statement: 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. I've explained the thought process and logic behind the solution and show how to implement it in code. Please like, share and subscribe if you found the video useful. Feel free to ask in the comments section if you have any doubts. 00:00 : Introduction 00:08 : Understanding Question 02:47 : Brute Force Approach 04:22 : Optimised Approach 09:18 : Coding #leetcodequestionandanswers #leetcodesolution #leetcode #leetcodesolutions #c++

Download

1 formats

Video Formats

360pmp414.0 MB

Right-click 'Download' and select 'Save Link As' if the file opens in a new tab.

Container With Most Water | Leetcode Problem 11 | C++ Solution | NatokHD