diff --git "a/leetcode2/1easy/\354\265\234\354\233\220\354\244\200/Q3184.java" "b/leetcode2/1easy/\354\265\234\354\233\220\354\244\200/Q3184.java" new file mode 100644 index 00000000..d81d7726 --- /dev/null +++ "b/leetcode2/1easy/\354\265\234\354\233\220\354\244\200/Q3184.java" @@ -0,0 +1,26 @@ +package Leetcode.최원준; + +/* +1. 아이디어 : +이중 포문으로 모든 조합을 확인 + +2. 시간복잡도 : +O( n*n) + +3. 자료구조/알고리즘 : +- / 브루트 포스 + */ + +public class Q3184 { + class Solution { + public int countCompleteDayPairs(int[] hours) { + int ans = 0; + int n = hours.length; + + for (int i=0; i nums = new ArrayList<>(); + nums.add(grid[x][y]); + int nx = x; + int ny = y; + for (int i=0; i=n || ++ny>=n) break; + nums.add(grid[nx][ny]); + } + + Collections.sort(nums, (x>=y)? Collections.reverseOrder() : null); + + grid[x][y] = nums.get(0); + nx = x; + ny = y; + for (int i=0; i=n || ++ny>=n) break; + grid[nx][ny] = nums.get(i+1); + } + } + + public int[][] sortMatrix(int[][] grid) { + this.grid = grid; + n = grid.length; + + for (int i=0; i=n) break; + cmax += cmax+1; + ans++; + } + cmax += num; + } + + while (cmax < n) { + cmax+= cmax+1; + ans++; + } + return ans; + } + } +}