From 408c4467052328119e9ce2a8f465e3c4cd4746b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B0=95=EC=8B=A0=EC=A7=80?= <101992179+ksinji@users.noreply.github.com> Date: Mon, 20 Oct 2025 22:37:09 +0900 Subject: [PATCH] =?UTF-8?q?[20251020]=20PGM=20/=20LV2=20/=20=EB=95=85?= =?UTF-8?q?=EB=94=B0=EB=A8=B9=EA=B8=B0=20/=20=EA=B0=95=EC=8B=A0=EC=A7=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...\205\353\224\260\353\250\271\352\270\260.md" | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 "ksinji/202510/20 PGM \353\225\205\353\224\260\353\250\271\352\270\260.md" diff --git "a/ksinji/202510/20 PGM \353\225\205\353\224\260\353\250\271\352\270\260.md" "b/ksinji/202510/20 PGM \353\225\205\353\224\260\353\250\271\352\270\260.md" new file mode 100644 index 00000000..ca1f5c43 --- /dev/null +++ "b/ksinji/202510/20 PGM \353\225\205\353\224\260\353\250\271\352\270\260.md" @@ -0,0 +1,17 @@ +```java +class Solution { + public int solution(int[][] land) { + int n = land.length; + int a = land[0][0], b = land[0][1], c = land[0][2], d = land[0][3]; + + for (int i = 1; i < n; i++) { + int na = land[i][0] + Math.max(Math.max(b, c), d); + int nb = land[i][1] + Math.max(Math.max(a, c), d); + int nc = land[i][2] + Math.max(Math.max(a, b), d); + int nd = land[i][3] + Math.max(Math.max(a, b), c); + a = na; b = nb; c = nc; d = nd; + } + return Math.max(Math.max(a, b), Math.max(c, d)); + } +} +```