-
-
Notifications
You must be signed in to change notification settings - Fork 195
[doitduri] WEEK 02 Solutions #1269
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Climbing stairs 코드 마지막줄 공백 추가해주셔야해요!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
헛!! 추가 완료했습니다 :) 꼼꼼하게 봐주셔서 감사합니다
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
중복 제거3sum 문제에 중복 제거 조건을 append 하고서 계속 밀어내며 확인하는 방식으로 하셨군요... 그냥 중복 제거라서 Set을 사용했었는데, 저 방법으로 해보니까 실제 실행시간도 빠르고 더 괜찮은거 같네요. 하나 배워갑니다!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
오오 Set을 이용해서 풀지 않았어서, 실행속도 측면에서 차이가 있을 줄은 몰랐네요! (같은 시간복잡도이지만 수행 시간이 차이 난다는게 흥미로운 것 같습니다 👀👀)
관련해서 코드 지피티에게 물어보니까
이 문제(threeSum)에서 이미 배열이 정렬되어 있고, 중복을 while 문으로 직접 건너뛰면서 처리하고 있기 때문입니다.
라고 합니다.
Set은 내부적으로 해시 함수를 계산해서, 값을 하나씩 넣을 때마다 연산 비용이 발생하는데
(아마도 제가 이해한게 맞다면?) 이미 정렬된 상태 + 조건 충족 시 append 연산 수행으로 인해서 정답 풀이를 하는데 있어 수행 속도가 조금 차이나지 않았나 싶습니다..!
저도 덕분에 깊이 있게 생각해보고 탐구해보는 계기가 되었네요 😄
좋은 의견 & 생각 공유 감사합니다~
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Climbing Stairs 답안 파일에 lint만 지키면 완성인거 같습니다
수고하셨습니다!
답안 제출 문제
작성자 체크 리스트
In Review
로 설정해주세요.검토자 체크 리스트
Important
본인 답안 제출 뿐만 아니라 다른 분 PR 하나 이상을 반드시 검토를 해주셔야 합니다!