본문 바로가기

Coding Test/Programmers

[프로그래머스/파이썬] 땅따먹기

728x90

나의 풀이

def solution(land):
    for step in range(1, len(land)):
        for i in range(4):
            land[step][i] += max(land[step - 1][i - 1], land[step - 1][i - 2], land[step - 1][i - 3])

    return max(land[-1])

 

 

 

 

 

반응형