From 3a8c6cd9e1f589ca17d7367aacb79124287d5a7f Mon Sep 17 00:00:00 2001 From: Akansha_chaurasia <125260131+Akansha77@users.noreply.github.com> Date: Tue, 23 Jan 2024 20:00:45 +0000 Subject: [PATCH] Day 21: Q2 - Container With Most Water #421 cpp code added by Akansha77 --- .../Akansha--C.cpp | 35 +++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 Day-21/q2 : Container With Most Water/Akansha--C.cpp diff --git a/Day-21/q2 : Container With Most Water/Akansha--C.cpp b/Day-21/q2 : Container With Most Water/Akansha--C.cpp new file mode 100644 index 00000000..242568db --- /dev/null +++ b/Day-21/q2 : Container With Most Water/Akansha--C.cpp @@ -0,0 +1,35 @@ +class Solution { +public: + int maxArea(vector& height) { + int a=height.size(); + int i=0; + int j=a-1; + int z=a-1; + int maxElement; + vector b; + while(ia-1){ + break; + } + } + else{ + j--; + } + z--; + } + for (int y = 0; y< a-1; ++y) { + if (b[y] > maxElement) { + maxElement = b[y]; + } + } + return maxElement; + } +}; \ No newline at end of file