전체 글 835

[알고리즘] LeetCode 1411 - Number of Ways to Paint N × 3 Grid (C++)

[문제 링크] : https://leetcode.com/problems/number-of-ways-to-paint-n-3-grid/description/ Number of Ways to Paint N × 3 Grid - LeetCodeCan you solve this real interview question? Number of Ways to Paint N × 3 Grid - You have a grid of size n x 3 and you want to paint each cell of the grid with exactly one of the three colors: Red, Yellow, or Green while making sure that no two adjacent cleetcode.com..

알고리즘 2026.09.11

[알고리즘] 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