[Ader] BOJ(14503): 로봇청소기 - 문제풀이 #145
Merged
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.
안녕하세요 아더입니다~!
이번 문제는
DFS로 접근했습니다.푸쉬하고 보니까
RobotCleaner객체를 괜히 만들었네요;;;;시간복잡도
O(V^2)로 예상됩니다!접근 과정
전체적인
DFS메소드의 흐름은 다음과 같습니다row,column값 계산추가) 현재 바라보는 방향의 왼쪽 방향 구하는 방법
0~3까지 차례로 북동남서 방향을 가리킵니다.
이 방향들의 왼쪽방향은 서북동남이며 이를 숫자로 나타내면 3012가 됩니다.
따라서 현재 위치를
d라고 한다면d = (d+3) % 4라는 수식으로 왼쪽 방향을 구할 수 있습니다.삽질 과정
이번 문제 해결도 고생많으셨습니다 여러분 👍