프로그래머스 알고리즘/Java4 [프로그래머스] 문자열 압축 - Java 프로그래머스SW개발자를 위한 평가, 교육, 채용까지 Total Solution을 제공하는 개발자 성장을 위한 베이스캠프programmers.co.krimport java.util.*;class Solution { private List generationToken(String s, int tokenLength) { List tokens = new ArrayList(); // -> 이 부분에서 실수. "앞에서부터" 조건을 만족하기 위해서는 tokenLength씩 반복해서 잘라내야 함 for (int startIndex = 0; startIndex s.length()) { endIndex = s.length(); } .. 2025. 2. 3. [프로그래머스] 거리두기 확인하기 - Java 프로그래머스SW개발자를 위한 평가, 교육, 채용까지 Total Solution을 제공하는 개발자 성장을 위한 베이스캠프programmers.co.kr import java.util.*;class Solution { class Node { int x; int y; int distance; Node(int x, int y, int distance) { this.x = x; this.y = y; this.distance = distance; } } private static final int[] dx = {0, 0, -1, 1}; private stati.. 2025. 2. 3. [프로그래머스] 교점에 별 만들기 - Java 프로그래머스SW개발자를 위한 평가, 교육, 채용까지 Total Solution을 제공하는 개발자 성장을 위한 베이스캠프programmers.co.kr import java.util.*;class Solution { private static class Point { public final long x; public final long y; private Point(long x, long y) { this.x = x; this.y = y; } public String toString() { return "\n" + "x: " + x + "\ny: " + y + "\n"; .. 2025. 2. 3. [프로그래머스] 삼각 달팽이 - Java 프로그래머스SW개발자를 위한 평가, 교육, 채용까지 Total Solution을 제공하는 개발자 성장을 위한 베이스캠프programmers.co.krclass Solution { public int[] solution(int n) { int[] answer = {}; int x = 0; int y = 0; int cnt = 1; int phase = 0; long[][] arr = new long[n][n]; arr[y][x] = cnt++; while (true) { // 아래로 이동 while (y + 1 .. 2025. 1. 15. 이전 1 다음