Skip to content
This repository has been archived by the owner on Oct 14, 2021. It is now read-only.

C solution for Container with most water. #490

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
added the solution for Container with most water.
  • Loading branch information
iamanshulgit committed Oct 2, 2021
commit fb65bc8414f8c02da9157fbe7633f224fdb1f88e
12 changes: 12 additions & 0 deletions Programming/C/MaxAreaOfArray.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
//Containre with Most Water
int maxArea(int A[], int len)
{
int area = 0;
for (int i = 0; i < len; i++) {
for (int j = i + 1; j < len; j++) {
// Calculating the max area
area = max(area, min(A[j], A[i]) * (j - i));
}
}
return area;
}