Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[우선순위큐] 3월 19일 #5

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

Jiwoon-Yoon
Copy link
Collaborator

인적사항

학번: 2276209
이름: 윤지운

과제제출

기존 제출: 2075, 2607, 14235
추가 제출:

Copy link

@hanby-choi hanby-choi left a comment

Choose a reason for hiding this comment

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

[우선순위 큐 구현 문제 코드리뷰 완료]
2607 코드리뷰 완료

안녕하세요 지운님! 이번 구현 문제 깔끔하게 잘 풀어주셨네요👍🏻 코드의 구조가 간결하여 이해하기 쉬웠습니다! 코드의 가독성을 높이기 위해 함수 작명에 관한 코멘트를 남겼으니 읽어보시면 좋을 것 같습니다😊

}
}

int solution(vector<int>& v, string word, int cnt, string flag) {

Choose a reason for hiding this comment

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

P3: 문제 상황에 맞게 두 단어의 구성 차이를 계산하는 함수를 잘 정의해 주셨네요! 다만 함수 이름을 지을 때 solution보다는 함수가 어떤 기능을 수행하는지 알 수 있게 지어주시면 더 좋을 것 같습니다. 이 경우 countDiff 같은 이름을 사용할 수 있겠네요!

Comment on lines +48 to +60
countAlpha(flag, v);

for (int i = 1; i < n; i++) {
string word;
cin >> word;

int diff = solution(v, word, cnt, flag);
if (diff == 0 || diff == 1 || (diff == 2 && flag.size() == word.size())) {
cnt++;
}
}

cout << cnt;

Choose a reason for hiding this comment

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

문제 상황에 맞게 입출력과 연산을 적절히 잘 분리해 주셨네요!

Copy link

@chaeri93 chaeri93 left a comment

Choose a reason for hiding this comment

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

[우선순위 큐 알고리즘 문제 코드 리뷰 완료]

14235, 2075

지운님 안녕하세요!
과제하시느라 수고 많으셨습니다!! 어려운 문제인데도 잘 풀어주셨네요! 🥰
코드에 대한 주석도 너무 좋았습니다 👍
몇 가지 사소한 코멘트 드렸습니다.
궁금한 점이 있으면 리뷰어를 호출해주세요!


if (a == 0) {
if (present.empty()) {
cout << -1 << "\n";

Choose a reason for hiding this comment

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

P3: cout << "-1\n"; 이렇게 한번에 작성해도 돼요!

Comment on lines +16 to +23
if (pq.size() < n) {
pq.push(num);
}
else {
if (pq.top() < num) {
pq.pop();
pq.push(num);
}

Choose a reason for hiding this comment

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

if문 없이 push 해주신다음에 pq의 사이즈가 n을 초과하면 pop을 해주는 로직으로 다시 구현해보면 좋을것같아요,,..!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants