PS22 [프로그래머스] 숫자 변환하기 - 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. [goorm] Dead Or Arrive - Java import java.io.BufferedReader;import java.io.IOException;import java.io.InputStreamReader;import java.util.Arrays;import java.util.StringTokenizer;public class DeadOrArrive { static class Car{ int v; int w; int number; public Car(int v, int w, int number){ this.v = v; this.w = w; this.number = number; } } public static .. 2024. 5. 21. 이전 1 2 3 4 ··· 6 다음