PS23 [프로그래머스] 테이블 해시 함수 - Java import java.util.*;class Solution { public int solution(int[][] data, int col, int row_begin, int row_end) { int answer = 0; Arrays.sort(data, (o1, o2) -> { if(o1[col - 1] == o2[col- 1]){ return o2[0] - o1[0]; } return o1[col - 1] - o2[col - 1]; }); List modSum = new ArrayList(); for(int.. 2024. 7. 4. [프로그래머스] 숫자 변환하기 - Java import java.util.*;class Solution { public int solution(int x, int y, int n) { int answer = 0; Queue q = new LinkedList(); q.add(new int[]{x, 0}); boolean[] visited = new boolean[y - x + 1]; while(!q.isEmpty()){ int[] curr = q.poll(); if(curr[0] == y){ return curr[1]; } .. 2024. 6. 22. [프로그래머스] 도넛과 막대 그래프 - Java import java.util.*;class Solution { List> graph; int maxVertex; boolean[] visited; boolean[] check; int[] inDegree; int startVertex; public void init(int[][] edges){ maxVertex = 0; check = new boolean[1000000]; for(int[] edge : edges){ check[edge[0]] = true; check[edge[1]] = true; maxVertex = Math... 2024. 6. 8. [프로그래머스] 혼자서 하는 틱택토 - Java class Solution { public int solution(String[] board) { String[][] board_Arr = new String[3][3]; for(int i = 0; i = 2){ return 0; } boolean check = false; boolean oWin = false; boolean xWin = false; for(int i = 0; i x){ return 0; } } } if(board.. 2024. 6. 7. 이전 1 2 3 4 ··· 6 다음