This repository was archived by the owner on Mar 18, 2024. It is now read-only.
[2023-10-06] sumin #301#331
Merged
Merged
Conversation
Closed
zsmalla
approved these changes
Oct 12, 2023
Contributor
zsmalla
left a comment
There was a problem hiding this comment.
카운터를 활용해 토핑 수를 비교하는 로직이 접근 방식이 저도 같아서 이해하기 어렵지 않았던 것 같습니다. 따로 코드 측면에서 피드백 드릴 부분은 없는 것 같네요! 고생하셨습니다 수민님!
Contributor
There was a problem hiding this comment.
이 경우를 별도의 카운트 변수를 두지 않고, 카운터의 key를 remove하는 방식으로 해도 좋을 것 같아요! 그러면 len으로 비교가 가능할 수 있습니다.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
PR Summary
풀이시간: 20분
<input>
topping: 롤케이크에 올려진 토핑들의 번호를 저장한 정수배열(1 ≤ topping의 길이 ≤ 1,000,000)
<solution>
전체 토핑의 개수와 토핑의 가짓수에서 철수가 먹게되는 토핑의 개수와 가짓수를 계속해서 갱신하며 답을 찾아나간다.
이 때, set 자료형을 써서 철수가 먹게되는 토핑의 가짓수를 O(1)에 탐색한다.
<시간복잡도>
O(N)