From ada0cc442c44189df6475ce48d77cbc2a7739381 Mon Sep 17 00:00:00 2001 From: junyoungKim Date: Sat, 6 Dec 2025 18:07:56 +0900 Subject: [PATCH 1/7] Find Minimum in Rotated Sorted Array solution --- .../kimjunyoung90.java | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 find-minimum-in-rotated-sorted-array/kimjunyoung90.java diff --git a/find-minimum-in-rotated-sorted-array/kimjunyoung90.java b/find-minimum-in-rotated-sorted-array/kimjunyoung90.java new file mode 100644 index 0000000000..651d4ff55d --- /dev/null +++ b/find-minimum-in-rotated-sorted-array/kimjunyoung90.java @@ -0,0 +1,18 @@ +// 요구사항 : 이진 탐색 이용 +class Solution { + public int findMin(int[] nums) { + int left = 0; + int right = nums.length - 1; + while(left < right) { + int mid = (left + right) / 2; + //중앙 값이 오른쪽 값보다 크다. = 최소값이 오른쪽 구간에 있음 + if(nums[mid] > nums[right]) { + left = mid + 1; + } else { + right = mid; + } + } + + return nums[left]; + } +} From f7408cbafac849bbb50ce2802f5d7195ecfd2891 Mon Sep 17 00:00:00 2001 From: junyoungKim Date: Sat, 6 Dec 2025 18:49:03 +0900 Subject: [PATCH 2/7] Word Search solution --- word-search/kimjunyoung90.java | 42 ++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 word-search/kimjunyoung90.java diff --git a/word-search/kimjunyoung90.java b/word-search/kimjunyoung90.java new file mode 100644 index 0000000000..606459190f --- /dev/null +++ b/word-search/kimjunyoung90.java @@ -0,0 +1,42 @@ +class Solution { + public boolean exist(char[][] board, String word) { + + int rows = board.length; + int columns = board[0].length; + boolean[][] visited = new boolean[rows][columns]; + for (int i = 0; i < rows; i++) { + for (int j = 0; j < columns; j++) { + if (dfs(board, word, i, j, 0, visited)) { + return true; + } + } + } + return false; + } + + private boolean dfs(char[][] board, String word, int row, int col, int idx, boolean[][] visited) { + //예외 처리 1 + if (idx == word.length()) return true; + + //예외 처리 2 + if (row < 0 || col < 0 || row >= board.length || col >= board[0].length) return false; + + //예외 처리 3 + if (visited[row][col]) return false; + + //1. 글자 체크 + if (board[row][col] != word.charAt(idx)) return false; + + //방문 처리 + visited[row][col] = true; + + //상, 하, 좌, 우 찾기 + boolean found = dfs(board, word, row + 1, col, idx + 1, visited) + || dfs(board, word, row - 1, col, idx + 1, visited) + || dfs(board, word, row, col + 1, idx + 1, visited) + || dfs(board, word, row, col - 1, idx + 1, visited); + + visited[row][col] = false; + return found; + } +} From e87f7d4ddb6dff2c8bd65eafd9ad89d24c298c96 Mon Sep 17 00:00:00 2001 From: junyoungKim Date: Sat, 6 Dec 2025 19:44:40 +0900 Subject: [PATCH 3/7] Coin Change solution --- coin-change/kimjunyoung90.java | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 coin-change/kimjunyoung90.java diff --git a/coin-change/kimjunyoung90.java b/coin-change/kimjunyoung90.java new file mode 100644 index 0000000000..3d835b167d --- /dev/null +++ b/coin-change/kimjunyoung90.java @@ -0,0 +1,28 @@ +import java.util.Arrays; + +class Solution { + //풀이 원리 = 특정 금액을 만들 때 최소 동전 수는 몇 개? + //예) 0원은 동전 0개 + // 1원은 동전 1개 + // 2원은 동전 1 + public int coinChange(int[] coins, int amount) { + //불가능한 값 + int max = amount + 1; + int[] dp = new int[amount + 1]; + //최소 동전 수를 모두 불가능한 값으로 설정 + Arrays.fill(dp, max); + dp[0] = 0; + + //금액 1원 부터 계산 + for (int i = 1; i <= amount; i++) { + //사용할 수 있는 동전을 꺼냄 + for(int coin: coins) { + if (coin <= i) { + dp[i] = Math.min(dp[i], dp[i - coin] + 1); + } + } + } + + return dp[amount] > amount ? -1 : dp[amount]; + } +} \ No newline at end of file From 871b0ed28a5ec828133ee2c07c3141bb48fdf6ec Mon Sep 17 00:00:00 2001 From: junyoungKim Date: Sat, 6 Dec 2025 19:54:45 +0900 Subject: [PATCH 4/7] Coin Change solution --- coin-change/kimjunyoung90.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/coin-change/kimjunyoung90.java b/coin-change/kimjunyoung90.java index 3d835b167d..77baa1a95c 100644 --- a/coin-change/kimjunyoung90.java +++ b/coin-change/kimjunyoung90.java @@ -25,4 +25,4 @@ public int coinChange(int[] coins, int amount) { return dp[amount] > amount ? -1 : dp[amount]; } -} \ No newline at end of file +} From 6ea5f6c9b867b2ce15e4f2c166e7661283999caa Mon Sep 17 00:00:00 2001 From: junyoungKim Date: Sat, 6 Dec 2025 19:57:13 +0900 Subject: [PATCH 5/7] Best Time to Buy and Sell Stock solution --- best-time-to-buy-and-sell-stock/kimjunyoung90.java | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 best-time-to-buy-and-sell-stock/kimjunyoung90.java diff --git a/best-time-to-buy-and-sell-stock/kimjunyoung90.java b/best-time-to-buy-and-sell-stock/kimjunyoung90.java new file mode 100644 index 0000000000..7728f7cf77 --- /dev/null +++ b/best-time-to-buy-and-sell-stock/kimjunyoung90.java @@ -0,0 +1,5 @@ +class Solution { + public int maxProfit(int[] prices) { + + } +} \ No newline at end of file From 0bad8e00c1a1efa40849b301cd49a1c18323e107 Mon Sep 17 00:00:00 2001 From: junyoungKim Date: Sat, 6 Dec 2025 19:57:25 +0900 Subject: [PATCH 6/7] Best Time to Buy and Sell Stock solution --- best-time-to-buy-and-sell-stock/kimjunyoung90.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/best-time-to-buy-and-sell-stock/kimjunyoung90.java b/best-time-to-buy-and-sell-stock/kimjunyoung90.java index 7728f7cf77..2f41d23b85 100644 --- a/best-time-to-buy-and-sell-stock/kimjunyoung90.java +++ b/best-time-to-buy-and-sell-stock/kimjunyoung90.java @@ -2,4 +2,4 @@ class Solution { public int maxProfit(int[] prices) { } -} \ No newline at end of file +} From bd5443d72028c376bdf9e18c778ceb1fe3132943 Mon Sep 17 00:00:00 2001 From: junyoungKim Date: Sat, 6 Dec 2025 21:40:46 +0900 Subject: [PATCH 7/7] Best Time to Buy and Sell Stock solution --- best-time-to-buy-and-sell-stock/kimjunyoung90.java | 5 ----- 1 file changed, 5 deletions(-) delete mode 100644 best-time-to-buy-and-sell-stock/kimjunyoung90.java diff --git a/best-time-to-buy-and-sell-stock/kimjunyoung90.java b/best-time-to-buy-and-sell-stock/kimjunyoung90.java deleted file mode 100644 index 2f41d23b85..0000000000 --- a/best-time-to-buy-and-sell-stock/kimjunyoung90.java +++ /dev/null @@ -1,5 +0,0 @@ -class Solution { - public int maxProfit(int[] prices) { - - } -}