IT/알고리즘

[프로그래머스] 3xn 타일링

남갯 2024. 11. 11. 19:38
SMALL

https://school.programmers.co.kr/learn/courses/30/lessons/12902?language=java

 

class Programmers_3xn타일링 {

    //n2 * n2 + (n4)
    @Test
    fun solution() {
        var size = 8
        var arrays = Array<Int>(size + 1) { 0 }
        arrays[0] = 1
        arrays[2] = 3

        for (i in 4 .. size step 2) {
            arrays[i] = arrays[i - 2] * 4 - arrays[i - 4]
        }
        System.out.println(arrays[size])
    }

}
LIST