Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[suwi] Week06 #914

Merged
merged 6 commits into from
Jan 19, 2025
Merged
Changes from 1 commit
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
Next Next commit
container-with-most-water solution
  • Loading branch information
sungjinwi committed Jan 17, 2025

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
commit 7811238773349db03d06c1187c78196074f24baf
13 changes: 13 additions & 0 deletions container-with-most-water/sungjinwi.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
class Solution:
def maxArea(self, height: List[int]) -> int:
l = 0
r = len(height) - 1
max_area = 0
while (l != r) :
cur_area = (r - l) * min(height[l], height[r])
max_area = max(cur_area, max_area)
if (height[l] >= height[r]) :
r -= 1
else :
l += 1
return max_area