Week8 박태환 SWEA 5658 보물상자비밀번호 풀이 #141
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.
풀이
이 문제를 봤을 때 어디서 풀어 본 것 같아서.. 생각보다 쉽게 푼 것 같습니다.
일단 4개의 변에 동일한 개수의 숫자가 있고, 한 칸 씩 밀려가면서 한 변에 있는 값들로 이루어진 숫자를 구해야 했기 때문에
저는 앞 뒤에 값을 넣기 좋은 Dequeue 를 사용하는게 좋다고 생각하였고 Dequeue를 사용해 풀었습니다...
그래서 일단 처음에 16진수로 되어 있는 것들을 Dequeue 에 쭉 ~ 넣어두고
총 3회전까지만 하면 됐기 때문에 N(총 숫자 갯수) / 4 가 0이 될 때 까지 반복하면서 한 칸 씩 밀리게 했고
안에서 N/4 개 마다 숫자를 구하면서 반복되도록 코드를 작성했습니다.
그리고 중복된 것들이 저장되지 않도록 HashSet을 이용했습니다.
리뷰 요청 사항
느낀점
문제를 많이 풀어보는게 중요하다고 생각이 들었습니다..