From 3da5aa85efc2bd533f6aa12f534fcd8a005ff926 Mon Sep 17 00:00:00 2001 From: 724thomas <724thomas@gmail.com> Date: Tue, 1 Jul 2025 10:02:26 +0900 Subject: [PATCH] =?UTF-8?q?[=EC=B5=9C=EC=9B=90=EC=A4=80]Day2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Q3402.java" | 29 ++++++++ .../Q2770.java" | 37 ++++++++++ .../Q1655.java" | 74 +++++++++++++++++++ 3 files changed, 140 insertions(+) create mode 100644 "leetcode2/1easy/\354\265\234\354\233\220\354\244\200/Q3402.java" create mode 100644 "leetcode2/2medium/\354\265\234\354\233\220\354\244\200/Q2770.java" create mode 100644 "leetcode2/3hard/\354\265\234\354\233\220\354\244\200/Q1655.java" diff --git "a/leetcode2/1easy/\354\265\234\354\233\220\354\244\200/Q3402.java" "b/leetcode2/1easy/\354\265\234\354\233\220\354\244\200/Q3402.java" new file mode 100644 index 00000000..4953a059 --- /dev/null +++ "b/leetcode2/1easy/\354\265\234\354\233\220\354\244\200/Q3402.java" @@ -0,0 +1,29 @@ +package Leetcode.최원준; + +/* +1. 아이디어 : +전 행의 값보다 1 큰 값으로 채워 넣습니다. + +2. 시간복잡도 : +O( n * m ) + +3. 자료구조/알고리즘 : +- / 브루트 포스 + */ + +public class Q3402 { + class Solution { + public int minimumOperations(int[][] grid) { + int n = grid.length, m = grid[0].length; + int ans = 0; + for (int row = 1; row counts = new ArrayList<>(); + Map counter = new HashMap<>(); + int[] nums, quantity; + int n, m; + boolean ans = false; + + public void backtrack(int idx) { + if (ans) return; + if (idx == m) { + ans = true; + return; + } + + int q = quantity[idx]; + for (int i=0; i