[Jay] BOJ(14503): 로봇 청소기 - 문제풀이 #148
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.
시간복잡도
세로 = N
가로 = M
시간 복잡도 = 빈칸의 수 * 4 방향
O(NM)
접근 과정
DirectionAreaStatusRobotVacuum문제에 나오는 항목들을 객체로 만들고, 각 객체에 역할을 부여하여 구현하였습니다.
핵심이 되는 객체는
RobotVacuum입니다.RobotVacuum의 역할그리고 각 방향은 다음 방향을 참조하도록 하였습니다.
삽질
=> 문제의 의도는 현재 방향을 기준으로 뒤로 간다는 의미