[Java] 백준 [11048] 이동하기
public class Solution { // 이동하기 - DP 11048번 static int n = 3; static int m = 4; static int[][] arr = {{1, 2, 3, 4}, {0, 0, 0, 5}, {9, 8, 7, 6}}; static int[] dy = {1, 1, 0}; static int[] dx = {0, 1, 1}; static int[][] dp = new int[n][m]; public static void dfs(int a, int b) { for (int i = 0; i n - 1 || nx > m - 1) { continue; } dp[ny][..
2022. 12. 10.
[Java] 프로그래머스 [Level-4] 쌍둥이 빌딩 숲
public class Solution { // 쌍둥이 빌딩 숲 // 전체 쌍둥이 빌딩의 수, 측면에서 봤을 때 보이는 빌딩의 수 [경우의 수] // 가장 높은 쌍둥이 빌딩부터 순서대로 배치 // 1, 1 = 11 [1개] // 2, 1 = 1221, 1122 [2개] 1 * 2 // 2, 2 = 2211 [1개] 1 // 3, 1 = 133221, 123321, 122331, 122133, 133122, 113322, 112332, 112233 [8개] 2 * 4 // 3, 2 = 233211, 223311, 221331, 221133, 331221, 331122 [6개] 1 * 4 + 2 // 3, 3 = 332211 [1개] 1 // 4, 1 = [48개] 8 * 6 // 4, 2 = [44개] 6..
2022. 12. 6.