전체 글 833

[알고리즘] LeetCode 1255 - Maximum Score Words Formed by Letters (C++)

[문제 링크] : https://leetcode.com/problems/maximum-score-words-formed-by-letters/description/ Maximum Score Words Formed by Letters - LeetCodeCan you solve this real interview question? Maximum Score Words Formed by Letters - Given a list of words, list of single letters (might be repeating) and score of every character. Return the maximum score of any valid set of words formed by using theleetcod..

알고리즘 2026.09.10

[알고리즘] LeetCode 1028 - Recover a Tree From Preorder Traversal (C++)

[문제 링크] : https://leetcode.com/problems/recover-a-tree-from-preorder-traversal/description/ Recover a Tree From Preorder Traversal - LeetCodeCan you solve this real interview question? Recover a Tree From Preorder Traversal - We run a preorder depth-first search (DFS) on the root of a binary tree. At each node in this traversal, we output D dashes (where D is the depth of this node), then weleet..

알고리즘 2026.09.08

[알고리즘] 프로그래머스 Level5 - 미로 주행 테스트 (Java)

[문제 링크] : https://school.programmers.co.kr/learn/courses/30/lessons/214295 프로그래머스SW개발자를 위한 평가, 교육의 Total Solution을 제공하는 개발자 성장을 위한 베이스캠프programmers.co.krimport java.util.*;class Solution { static final long MASK = (1L uHigh || vLow > vHigh) { return 0; } baseVLow = -((long)m); baseVHigh = n; int maxNo = tests.length; long[] rectVL = new long[maxN..

알고리즘 2026.09.07

[알고리즘] 프로그래머스 Level5 - 쿼리의 모음의 개수 (Java)

[문제 링크] : https://school.programmers.co.kr/learn/courses/30/lessons/87394 프로그래머스SW개발자를 위한 평가, 교육의 Total Solution을 제공하는 개발자 성장을 위한 베이스캠프programmers.co.krimport java.util.*;class Solution { int q; int n; long[][] comb; long[][] pow; public int solution(int q, int[] a) { this.q = q; this.n = a.length; buildComb(); buildPow(); TreeSet set = new TreeS..

알고리즘 2026.09.06

[알고리즘] 프로그래머스 Level5 - IU와 콘의 보드게임 (Java)

[문제 링크] : https://school.programmers.co.kr/learn/courses/30/lessons/1841 프로그래머스SW개발자를 위한 평가, 교육의 Total Solution을 제공하는 개발자 성장을 위한 베이스캠프programmers.co.krimport java.util.*;class Solution { public int solution(int n, int[][] triangle, int[][] v) { if(n == 0) { return 1; } if(n == 1) { return 3; } long[][] t = new long[3][2]; for(int..

알고리즘 2026.09.05

[알고리즘] 프로그래머스 Level5 - 중력 작용 (Java)

[문제 링크] : https://school.programmers.co.kr/learn/courses/30/lessons/77887 프로그래머스SW개발자를 위한 평가, 교육의 Total Solution을 제공하는 개발자 성장을 위한 베이스캠프programmers.co.krimport java.util.*;class Solution { static int n; static int[] head; static int[] to; static int[] next; static int edges; static int[] parent; static int[] subtreeSize; static int[] heavy; static int[] chainHead; st..

알고리즘 2026.09.04

[알고리즘] 프로그래머스 Level5 - 문자열과 알파벳과 쿼리 (Java)

[문제 링크] : https://school.programmers.co.kr/learn/courses/30/lessons/389632 프로그래머스SW개발자를 위한 평가, 교육의 Total Solution을 제공하는 개발자 성장을 위한 베이스캠프programmers.co.krimport java.util.*;class Solution { static class Node { int[] pos; int[] lazy; Node(int[] pos, int initialToken) { this.pos = pos; if(pos.length > 0) { lazy = new int[pos.length * 4 + ..

알고리즘 2026.09.03

[알고리즘] 프로그래머스 Level5 - 눈사람 만들기 (Java)

[문제 링크] : https://school.programmers.co.kr/learn/courses/30/lessons/389631 프로그래머스SW개발자를 위한 평가, 교육의 Total Solution을 제공하는 개발자 성장을 위한 베이스캠프programmers.co.krimport java.util.*;class Solution { static final int[] dy = {1, 0, -1, 0}; static final int[] dx = {0, 1, 0, -1}; public long solution(String[] grid) { int n = grid.length; int m = grid[0].length(); int size = n * m..

알고리즘 2026.09.02

[알고리즘] 프로그래머스 Level5 - RPG와 쿼리 (Java)

[문제 링크] : https://school.programmers.co.kr/learn/courses/30/lessons/76504 프로그래머스SW개발자를 위한 평가, 교육의 Total Solution을 제공하는 개발자 성장을 위한 베이스캠프programmers.co.krimport java.util.*;class Solution { public long[] solution(int n, int z, int[][] roads, long[] queries) { int limit = z * z; int[][] dp = new int[n][limit + 1]; int[] best = new int[limit + 1]; for(int i = 0; i

알고리즘 2026.09.01