From e0cd3f2520f246cfe304a06dca57b9ba0a1288f7 Mon Sep 17 00:00:00 2001
From: mangodm-web <mangodm.web3@gmail.com>
Date: Thu, 19 Sep 2024 11:19:28 +0900
Subject: [PATCH 1/3] feat: add container with most water solution

---
 container-with-most-water/mangodm-web.py | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)
 create mode 100644 container-with-most-water/mangodm-web.py

diff --git a/container-with-most-water/mangodm-web.py b/container-with-most-water/mangodm-web.py
new file mode 100644
index 000000000..f945327b6
--- /dev/null
+++ b/container-with-most-water/mangodm-web.py
@@ -0,0 +1,24 @@
+from typing import List
+
+
+class Solution:
+    def maxArea(self, height: List[int]) -> int:
+        """
+        - Idea: 배열의 양쪽 끝에서 시작하는 두 포인터(left, right)를 이용해 두 선 사이의 최대 영역을 구한다. 둘 중, 높이가 낮은 쪽의 포인터는 중앙 쪽으로 이동시킨다.
+        - Time Complexity: O(n), n은 주어진 배열(height)의 길이.
+        - Space Complexity: O(1), 추가 공간은 사용하지 않는다.
+        """
+        left, right = 0, len(height) - 1
+        result = 0
+
+        while left < right:
+            current_width = right - left
+            current_height = min(height[left], height[right])
+            result = max(result, current_width * current_height)
+
+            if height[left] < height[right]:
+                left += 1
+            else:
+                right -= 1
+
+        return result

From e93c1d022297b9c8558956c6fe284f6093e694b2 Mon Sep 17 00:00:00 2001
From: mangodm-web <mangodm.web3@gmail.com>
Date: Thu, 19 Sep 2024 11:23:41 +0900
Subject: [PATCH 2/3] feat: add spiral matrix solution

---
 spiral-matrix/mangodm-web.py | 37 ++++++++++++++++++++++++++++++++++++
 1 file changed, 37 insertions(+)
 create mode 100644 spiral-matrix/mangodm-web.py

diff --git a/spiral-matrix/mangodm-web.py b/spiral-matrix/mangodm-web.py
new file mode 100644
index 000000000..58d614061
--- /dev/null
+++ b/spiral-matrix/mangodm-web.py
@@ -0,0 +1,37 @@
+from typing import List
+
+
+class Solution:
+    def spiralOrder(self, matrix: List[List[int]]) -> List[int]:
+        """
+        - Idea: 네 개의 포인터(left, right, top, bottom)를 활용하여 행렬의 바깥쪽부터 안쪽으로 순회한다.
+            - left, right: 행렬의 왼쪽과 오른쪽 끝. 순회하면서 점점 좁혀진다.
+            - top, bottom: 행렬의 위쪽과 아래쪽. 순회하면서 점점 좁혀진다.
+        - Time Complexity: O(m*n), m, n은 각각 주어진 행렬(matrix)의 행과 열의 개수. 행렬의 모든 요소를 한번씩 접근한다.
+        - Space Complexity: O(1), 결과 리스트(result)를 제외하고 포인터를 위한 상수 크기의 변수 이외의 추가 공간은 사용하지 않는다.
+        """
+        result = []
+        left, right = 0, len(matrix[0])
+        top, bottom = 0, len(matrix)
+
+        while left < right and top < bottom:
+            for i in range(left, right):
+                result.append(matrix[top][i])
+            top += 1
+
+            for i in range(top, bottom):
+                result.append(matrix[i][right - 1])
+            right -= 1
+
+            if not (left < right and top < bottom):
+                break
+
+            for i in range(right - 1, left - 1, -1):
+                result.append(matrix[bottom - 1][i])
+            bottom -= 1
+
+            for i in range(bottom - 1, top - 1, -1):
+                result.append(matrix[i][left])
+            left += 1
+
+        return result

From ce4b722dfc1c02a81e6d5d5ae209a9fffcbfc97e Mon Sep 17 00:00:00 2001
From: mangodm-web <mangodm.web3@gmail.com>
Date: Thu, 19 Sep 2024 11:24:07 +0900
Subject: [PATCH 3/3] feat: add valid parentheses solution

---
 valid-parentheses/mangodm-web.py | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)
 create mode 100644 valid-parentheses/mangodm-web.py

diff --git a/valid-parentheses/mangodm-web.py b/valid-parentheses/mangodm-web.py
new file mode 100644
index 000000000..77d46c93f
--- /dev/null
+++ b/valid-parentheses/mangodm-web.py
@@ -0,0 +1,17 @@
+class Solution:
+    def isValid(self, s: str) -> bool:
+        """
+        - Idea: 주어진 문자열을 순회하면서 여는 괄호는 스택에 넣고, 닫는 괄호는 스택의 최상단 요소와 매칭되는지 확인한다.
+        - Time Complexity: O(n), n은 주어진 문자열의 길이. 모든 문자를 한번씩은 순회한다.
+        - Space Complexity: O(n), 주어진 문자열이 모두 여는 괄호일 경우 스택에 저장된다.
+        """
+        bracket_map = {"(": ")", "[": "]", "{": "}"}
+        stack = []
+
+        for char in s:
+            if char in bracket_map:
+                stack.append(char)
+            elif not stack or bracket_map[stack.pop()] != char:
+                return False
+
+        return not stack