diff --git a/Container With Most Water.cpp b/Container With Most Water.cpp new file mode 100644 index 0000000..87a4e02 --- /dev/null +++ b/Container With Most Water.cpp @@ -0,0 +1,30 @@ +class Solution { +public: + int maxArea(vector& height) { + int m=height.size(); + int temp=0,rem=0; + int f=0,l=m-1; + while(f!=l) + { + if(height[f]rem) + { + rem=temp; + } + } + else + { + temp=height[l]*(l-f); + l--; + if(temp>rem) + { + rem=temp; + } + } + } + return rem; + } +};