Skip to content

[손재영] level2 배달 풀이 및 주석 #76

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

Merged
merged 3 commits into from
Jul 25, 2022

Conversation

pereng11
Copy link
Contributor

@pereng11 pereng11 commented Jul 23, 2022

level2 배달 문제 풀이 및 주석

https://school.programmers.co.kr/learn/courses/30/lessons/12978#

  • solution1: 다익스트라 + 최소힙(클래스로 구현)
  • solution2: 다익스트라 + 큐(따로 구현하지 않고 자바스크립트 배열 그냥 사용)

시간복잡도가 1번 풀이는 O(N*logN), 2번 풀이는 O(N^2)이라고 생각했는데 프로그래머스 제출 시간으로는 2번이 더 빠르게 나옵니다

++ 커밋컨벤션을 제대로 확인하지 못했네요 다음 풀이 때는 신경써서 커밋하겠습니다 😢

Copy link
Owner

@codeisneverodd codeisneverodd left a comment

Choose a reason for hiding this comment

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

너무 멋진 풀이들 잘 보았습니다!!
리뷰 확인 부탁드리고, 풀이가 멋져서 이 문제 풀어보고 헬프 요청하겠습니다 😄

function solution ( N, road, K )
{
// [목적지, 거리] 노드를 값으로 가지는, 거리에 대한 최소힙
class MinHeap{
Copy link
Owner

Choose a reason for hiding this comment

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

"반영하지 않아도 좋아요"

class 가 solution 내가 아닌 밖에 선언되어 있고, solution 내에는 로직을 더 알아볼 수 있게 되어있으면 깔끔할 것 같아요!
코딩테스트를 할 때는 무방하지만, 테스트 환경일 때도 로직을 분리해놓고 생각하는 것이 더 명료하다고 생각되어요!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

문제 풀이 때는 솔루션 함수 밖으로 나갈 생각을 못했는데, 듣고 보니 구조나 가독성 측면에서는 말씀하신 것처럼 분리하는 게 더 적절해 보이네요. 좋은 의견 감사합니다 👍

@@ -0,0 +1,189 @@
//정답 1 - pereng11
Copy link
Owner

Choose a reason for hiding this comment

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

"반영 필수적으로 해주세요!"

주석 잘 다셨습니다!! 다만 새로운 파일이라 파일 최상단에

//https://github.com/codeisneverodd/programmers-coding-test
//완벽한 정답이 아닙니다.

를 추가하여주세요! 헷갈리시면 다른 파일을 참고하시면 좋습니다 ㅎㅎ

@codeisneverodd codeisneverodd changed the base branch from main to week July 25, 2022 10:34
@codeisneverodd codeisneverodd merged commit 9a020a1 into codeisneverodd:week Jul 25, 2022
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.

2 participants