From ac35ebd37ca6de830f8c303c980499ecd97b41f6 Mon Sep 17 00:00:00 2001 From: Won Joon Thomas Choi <113500771+724thomas@users.noreply.github.com> Date: Sun, 13 Sep 2026 18:42:42 +0900 Subject: [PATCH] =?UTF-8?q?Create=201411.=20Number=20of=20Ways=20to=20Pain?= =?UTF-8?q?t=20N=20=C3=97=203=20Grid.py?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...1. Number of Ways to Paint N \303\227 3 Grid.py" | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 "leetcode3/\354\265\234\354\233\220\354\244\200/1411. Number of Ways to Paint N \303\227 3 Grid.py" diff --git "a/leetcode3/\354\265\234\354\233\220\354\244\200/1411. Number of Ways to Paint N \303\227 3 Grid.py" "b/leetcode3/\354\265\234\354\233\220\354\244\200/1411. Number of Ways to Paint N \303\227 3 Grid.py" new file mode 100644 index 00000000..e3596c41 --- /dev/null +++ "b/leetcode3/\354\265\234\354\233\220\354\244\200/1411. Number of Ways to Paint N \303\227 3 Grid.py" @@ -0,0 +1,13 @@ +class Solution: + def numOfWays(self, n: int) -> int: + MOD = 1_000_000_007 + + aba = 6 + abc = 6 + + for _ in range(1, n): + aba, abc = ( + (aba * 3 + abc * 2) % MOD, + (aba * 2 + abc * 2) % MOD + ) + return (aba + abc) % MOD