From a7462b8adac4ba67677ba22e3e4aec59060dbe43 Mon Sep 17 00:00:00 2001 From: ICE0208 Date: Sat, 1 Aug 2026 13:31:57 +0900 Subject: [PATCH 1/6] valid parenthese --- valid-parentheses/ICE0208.java | 37 ++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 valid-parentheses/ICE0208.java diff --git a/valid-parentheses/ICE0208.java b/valid-parentheses/ICE0208.java new file mode 100644 index 0000000000..32e7b4a034 --- /dev/null +++ b/valid-parentheses/ICE0208.java @@ -0,0 +1,37 @@ +import java.util.ArrayDeque; +import java.util.Deque; +import java.util.HashMap; +import java.util.Map; + +class Solution { + public boolean isValid(String s) { + Deque stack = new ArrayDeque<>(); + Map mapping = new HashMap<>(); + mapping.put(')', '('); + mapping.put('}', '{'); + mapping.put(']', '['); + + for (Character c : s.toCharArray()) { + // 열린 괄호일 때, 스택에 push + if (c=='(' || c=='{' || c == '[') { + stack.push(c); + continue; + } + + // 닫힌 괄호일 때, 스택에서 pop한 뒤, 비교 + // 스택이 비어있으면 탈락 + if (stack.isEmpty()) { + return false; + } + Character popedC = stack.pop(); + Character target = mapping.get(c); + // 같은 종류의 괄호가 아니면 탈락 + if (!target.equals(popedC)) { + return false; + } + } + + // 마지막에 스택이 비어있어야 성공 + return stack.isEmpty(); + } +} From f713f278679bf7ff9e41fdc371fba3cb24b0108e Mon Sep 17 00:00:00 2001 From: ICE0208 Date: Sat, 1 Aug 2026 13:32:47 +0900 Subject: [PATCH 2/6] =?UTF-8?q?container=20with=20most=20water=201?= =?UTF-8?q?=EC=B0=A8=20=ED=92=80=EC=9D=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- container-with-most-water/ICE0208.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 container-with-most-water/ICE0208.py diff --git a/container-with-most-water/ICE0208.py b/container-with-most-water/ICE0208.py new file mode 100644 index 0000000000..0f90688740 --- /dev/null +++ b/container-with-most-water/ICE0208.py @@ -0,0 +1,18 @@ +class Solution: + def maxArea(self, height: List[int]) -> int: + left, right = 0, len(height) - 1 + + most_water_size = 0 + while (left < right): + left_h, right_h = height[left], height[right] + + current_size = (right-left) * min(left_h, right_h) + most_water_size = max(most_water_size, current_size) + + if left_h < right_h: + left += 1 + else: + right -= 1 + + + return most_water_size From ace654496bb54cdd8e63dee490f126624f39a099 Mon Sep 17 00:00:00 2001 From: ICE0208 Date: Sat, 1 Aug 2026 13:33:43 +0900 Subject: [PATCH 3/6] =?UTF-8?q?design=20add=20blabla=201=EC=B0=A8=20?= =?UTF-8?q?=ED=92=80=EC=9D=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ICE0208.py | 47 +++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 design-add-and-search-words-data-structure/ICE0208.py diff --git a/design-add-and-search-words-data-structure/ICE0208.py b/design-add-and-search-words-data-structure/ICE0208.py new file mode 100644 index 0000000000..c1458c08c0 --- /dev/null +++ b/design-add-and-search-words-data-structure/ICE0208.py @@ -0,0 +1,47 @@ +class TrieNode: + def __init__(self): + self.children = {} + self.is_end = False + + +class WordDictionary: + + def __init__(self): + self.root = TrieNode() + + def addWord(self, word: str) -> None: + current = self.root + + for char in word: + if char not in current.children: + current.children[char] = TrieNode() + + current = current.children[char] + + current.is_end = True + + def search(self, word: str) -> bool: + def dfs(index: int, node: TrieNode) -> bool: + # 패턴을 모두 확인했을 때 실제 단어의 끝인지 확인한다. + if index == len(word): + return node.is_end + + char = word[index] + + # '.'은 현재 노드의 모든 자식 문자와 대응될 수 있다. + if char == ".": + for child in node.children.values(): + if dfs(index + 1, child): + return True + + return False + + # 일반 문자는 해당 자식 노드만 확인한다. + child = node.children.get(char) + + if child is None: + return False + + return dfs(index + 1, child) + + return dfs(0, self.root) From 0bc2d3935696e50b44f76a01a1bf60d32bfb9156 Mon Sep 17 00:00:00 2001 From: ICE0208 Date: Sat, 1 Aug 2026 13:34:30 +0900 Subject: [PATCH 4/6] =?UTF-8?q?lis=201=EC=B0=A8=20=ED=92=80=EC=9D=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- longest-increasing-subsequence/ICE0208.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 longest-increasing-subsequence/ICE0208.py diff --git a/longest-increasing-subsequence/ICE0208.py b/longest-increasing-subsequence/ICE0208.py new file mode 100644 index 0000000000..e5e52793b0 --- /dev/null +++ b/longest-increasing-subsequence/ICE0208.py @@ -0,0 +1,12 @@ +class Solution: + def lengthOfLIS(self, nums: List[int]) -> int: + # dp[i] : i를 마지막으로 했을 때 가장긴 증가 부분수열 + dp = [0] * len(nums) + + for i in range(0, len(nums)): + dp[i] = 1 + for j in range(0, i): + if nums[j] < nums[i]: + dp[i] = max(dp[i], dp[j] + 1) + + return max(dp) From 2dd87999a6d042af263d98b47f9abab87763f278 Mon Sep 17 00:00:00 2001 From: ICE0208 Date: Sat, 1 Aug 2026 13:35:57 +0900 Subject: [PATCH 5/6] =?UTF-8?q?spiral=20matrix=201=EC=B0=A8=20=ED=92=80?= =?UTF-8?q?=EC=9D=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- spiral-matrix/ICE0208.py | 41 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 spiral-matrix/ICE0208.py diff --git a/spiral-matrix/ICE0208.py b/spiral-matrix/ICE0208.py new file mode 100644 index 0000000000..ea6c0deb20 --- /dev/null +++ b/spiral-matrix/ICE0208.py @@ -0,0 +1,41 @@ +# 이렇게 푸는게 맞나..? 싶은데 +# 일단 1차 제출하고 리팩토링 해보겠습니다. 🫠 + +class Solution: + def spiralOrder(self, matrix: List[List[int]]) -> List[int]: + total = sum(map(lambda k: len(k), matrix)) + answer = [] + visit = [[False] * len(matrix[0]) for _ in range(len(matrix))] + + def inRange(i, j): + if not (0<=i Date: Sat, 1 Aug 2026 21:32:35 +0900 Subject: [PATCH 6/6] =?UTF-8?q?spiral=20matrix=20=EA=B3=B5=EA=B0=84=20?= =?UTF-8?q?=EB=B3=B5=EC=9E=A1=EB=8F=84=20=EC=A4=84=EC=9D=B4=EA=B8=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- spiral-matrix/ICE0208.py | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/spiral-matrix/ICE0208.py b/spiral-matrix/ICE0208.py index ea6c0deb20..09144a90c7 100644 --- a/spiral-matrix/ICE0208.py +++ b/spiral-matrix/ICE0208.py @@ -1,11 +1,15 @@ -# 이렇게 푸는게 맞나..? 싶은데 -# 일단 1차 제출하고 리팩토링 해보겠습니다. 🫠 - class Solution: def spiralOrder(self, matrix: List[List[int]]) -> List[int]: + VISIT_NUM = 10000 + total = sum(map(lambda k: len(k), matrix)) answer = [] - visit = [[False] * len(matrix[0]) for _ in range(len(matrix))] + + def isVisit(i, j): + return matrix[i][j] == VISIT_NUM + + def setVisit(i, j): + matrix[i][j] = VISIT_NUM def inRange(i, j): if not (0<=i