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.
HashMap 으로 풀어야 알맞은 문제지만 한번 List Sort를 이용한 문제도 한번 풀어봤습니다.
확실히 속도를 비교해보니까 적게는 4배 많게는 5배 이상의 처리 속도 차이를 보여주더라고요.
그리고 HashMap인 경우 단순히 HashMap.get를 통해 키를 탐색하는 것보다 Key와 Value 둘다 가져와야 하는 경우에는 EntrySet 이 속도가 더 빠르다고 합니다. 물론 둘다 빅오 표기으로는 N에 해당하지만 1N과 3N의 정도의 차이(정확한 차이는 모름)는 있다고 합니다.
다른 문제 풀이는 보는 와중에 해당 연산 속도 관련해서 출처글을 올려놨길래 혹시나 해서 남겨봐요 행님
https://stackoverflow.com/questions/3870064/performance-considerations-for-keyset-and-entryset-of-map