sayak2k1maruti/competetivePogramming

Write a function in CPP or Python to achieve below functionality ( Container With Most Water)

Opened this issue · 3 comments

What to Do?

Location

  • Go to folder /CP/LeetCode/Container With Most Water/

File name

  • Take your GitHub username id like "hrithik339", "hacker-boy", etc or anything which you have.
  • Then add programming language extension after this (link for C++ add .cpp and for python add.py)
  • Only files with the correct file name will be accepted

Problem - Container With Most Water

Link : https://leetcode.com/problems/container-with-most-water/

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.

Return the maximum amount of water a container can store.

Notice that you may not slant the container.
image

Example 1

Input: height = [1,8,6,2,5,4,8,3,7]
Output: 49

Exmple 2

Input: height = [1,1]
Output: 1

Constrains

  • n == height.length
  • 2 <= n <= 105
  • 0 <= height[i] <= 10

Please assign me this issue

Hello @sayak2k1maruti
I have a good knowledge in C++. Can you please assign this to me? Thank you.

Hello @sayak2k1maruti
I have a good knowledge in C++. Can you please assign this to me? Thank you.

Don't wait for assigning, just make a PR