Skip to content

[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

Merged
merged 6 commits into from
Apr 14, 2025
Merged

[doitduri] WEEK 02 Solutions #1269

merged 6 commits into from
Apr 14, 2025

Conversation

doitduri
Copy link
Contributor

@doitduri doitduri commented Apr 12, 2025

답안 제출 문제

작성자 체크 리스트

  • 우측 메뉴에서 PR을 Projects에 추가해주세요.
  • Projects의 오른쪽 버튼(▼)을 눌러 확장한 뒤, Week를 현재 주차로 설정해주세요.
  • 문제를 모두 푸시면 프로젝트에서 StatusIn Review로 설정해주세요.
  • 코드 검토자 1분 이상으로부터 승인을 받으셨다면 PR을 병합해주세요.

검토자 체크 리스트

Important

본인 답안 제출 뿐만 아니라 다른 분 PR 하나 이상을 반드시 검토를 해주셔야 합니다!

  • 바로 이전에 올라온 PR에 본인을 코드 리뷰어로 추가해주세요.
  • 본인이 검토해야하는 PR의 답안 코드에 피드백을 주세요.
  • 토요일 전까지 PR을 병합할 수 있도록 승인해주세요.

@doitduri doitduri moved this from Solving to In Review in 리트코드 스터디 4기 Apr 12, 2025
Copy link
Contributor

Choose a reason for hiding this comment

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

Climbing stairs 코드 마지막줄 공백 추가해주셔야해요!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

헛!! 추가 완료했습니다 :) 꼼꼼하게 봐주셔서 감사합니다

Copy link
Contributor

Choose a reason for hiding this comment

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

중복 제거3sum 문제에 중복 제거 조건을 append 하고서 계속 밀어내며 확인하는 방식으로 하셨군요... 그냥 중복 제거라서 Set을 사용했었는데, 저 방법으로 해보니까 실제 실행시간도 빠르고 더 괜찮은거 같네요. 하나 배워갑니다!

Copy link
Contributor Author

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 연산 수행으로 인해서 정답 풀이를 하는데 있어 수행 속도가 조금 차이나지 않았나 싶습니다..!

저도 덕분에 깊이 있게 생각해보고 탐구해보는 계기가 되었네요 😄
좋은 의견 & 생각 공유 감사합니다~

Copy link
Contributor

@JustHm JustHm left a comment

Choose a reason for hiding this comment

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

Climbing Stairs 답안 파일에 lint만 지키면 완성인거 같습니다
수고하셨습니다!

@doitduri doitduri merged commit a9db161 into DaleStudy:main Apr 14, 2025
1 check passed
@github-project-automation github-project-automation bot moved this from In Review to Completed in 리트코드 스터디 4기 Apr 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Completed
Development

Successfully merging this pull request may close these issues.

2 participants