Skip to content
This repository was archived by the owner on Mar 18, 2024. It is now read-only.

[2023-10-06] sumin #301#331

Merged
zsmalla merged 1 commit into
mainfrom
sumin-#301
Mar 18, 2024
Merged

[2023-10-06] sumin #301#331
zsmalla merged 1 commit into
mainfrom
sumin-#301

Conversation

@ksumini
Copy link
Copy Markdown
Contributor

@ksumini ksumini commented Oct 10, 2023

PR Summary

풀이시간: 20분

<input>
topping: 롤케이크에 올려진 토핑들의 번호를 저장한 정수배열(1 ≤ topping의 길이 ≤ 1,000,000)

  • 1 ≤ topping의 원소 ≤ 10,000

<solution>
전체 토핑의 개수와 토핑의 가짓수에서 철수가 먹게되는 토핑의 개수와 가짓수를 계속해서 갱신하며 답을 찾아나간다.
이 때, set 자료형을 써서 철수가 먹게되는 토핑의 가짓수를 O(1)에 탐색한다.

<시간복잡도>
O(N)

@ksumini ksumini self-assigned this Oct 10, 2023
@ksumini ksumini linked an issue Oct 10, 2023 that may be closed by this pull request
Copy link
Copy Markdown
Contributor

@zsmalla zsmalla left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

카운터를 활용해 토핑 수를 비교하는 로직이 접근 방식이 저도 같아서 이해하기 어렵지 않았던 것 같습니다. 따로 코드 측면에서 피드백 드릴 부분은 없는 것 같네요! 고생하셨습니다 수민님!

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

이 경우를 별도의 카운트 변수를 두지 않고, 카운터의 key를 remove하는 방식으로 해도 좋을 것 같아요! 그러면 len으로 비교가 가능할 수 있습니다.

@zsmalla zsmalla merged commit 766cf2b into main Mar 18, 2024
@zsmalla zsmalla deleted the sumin-#301 branch March 18, 2024 10:05
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Programmers] 롤케이크 자르기

2 participants