Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
📖 풀이한 문제
💡 문제에서 사용된 알고리즘
📜 코드 설명
int[][] land
와 같은 크기를 갖는int[][] dp
를 생성해 각 위치에 까지 다다랐을 때 최고점을 기록했다. 따라서 0번째 행은 시작점으로,land[0]
과 같은 값을 가진다.N-1
만큼dp
의 행을 순회하며 각0
~3
번째 값을 전 행의 자신과 겹치지 않는 행들에 한해 최고값을 구해 현재 땅점수와 더해준다.e.g.) {1, 0} 위치는 {0, 0} 에서 올 수 없으므로 {0, 1}, {0, 2}, {0, 3} 을 비교해 최고값을 구한다음 {1, 0} 땅점수를 더해준다.
close #263