프로그래머스. 땅따먹기 파이썬 풀이

minan·2021년 6월 29일
0

프로그래머스

목록 보기
81/92

프로그래머스. Level 2. 땅따먹기 파이썬 풀이

문제링크 https://programmers.co.kr/learn/courses/30/lessons/12913

다음 행의 점수에 현재 행의 다음 열과 같지 않은 가장 큰 수를 더하여 진행

def solution(land):
    answer = 0
    
    for i in range(len(land)-1):
        for j in range(len(land[0])):
            land[i+1][j] = land[i+1][j] + max(land[i][0:j] + land[i][j+1:])

    return max(land[-1])
profile
https://github.com/minhaaan

0개의 댓글