Week10 김수빈 9082 지뢰찾기 풀이 #158
Open
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.
풀이
이런 규칙을 활용해서 0이 아닐경우는 무조건 지뢰를 가지고 있으니, 세가지 방향을 다 확인해서 0이 아닐 경우는 세 방향에 있는 값을 1씩 빼주고, 지뢰카운트를 1씩 올려주었습니다.
숫자 지뢰 배열만큼 반복을 돌리는데, 0번째 인덱스와, N-1인덱스만 범위를 다르게 확인해야하므로 조건문을 따로 빼서 확인하는 작업을 가졌습니다. 나머지 인덱스 같은 경우는 왼쪽, 현재위치, 오른쪽를 모두 확인하는 작업을 else문으로 주었습니다.
리뷰 요청 사항
느낀점 💣