Skip to content

[junzero741] WEEK 03 Solutions#2439

Merged
junzero741 merged 2 commits intoDaleStudy:mainfrom
junzero741:main
Mar 21, 2026
Merged

[junzero741] WEEK 03 Solutions#2439
junzero741 merged 2 commits intoDaleStudy:mainfrom
junzero741:main

Conversation

@junzero741
Copy link
Contributor

@junzero741 junzero741 commented Mar 17, 2026

답안 제출 문제

작성자 체크 리스트

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

검토자 체크 리스트

Important

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

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

Copy link
Contributor

@Cyjin-jani Cyjin-jani left a comment

Choose a reason for hiding this comment

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

이번 3주차도 고생 많으셨습니다🙌

Comment on lines +5 to +6
let L = 0;
let R = s.length-1;
Copy link
Contributor

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.

대문자로 쓰는 것도 좋네요.
배워갑니다.

let L = 0;
let R = s.length-1;

while(R > 0 && L < s.length - 1 && L <= R) {
Copy link
Contributor

Choose a reason for hiding this comment

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

while 조건이 조금 복잡한 것 같다는 생각이 들었습니다🤔

while (L < R) 로 줄여볼 수도 있을 것 같아요!

L은 항상 0 이상이므로 L < R이면 R > 0은 자동으로 보장되는 것 같습니다.. R의 경우에도 항상 s.length - 1 이하이므로 L < R이면 L < s.length - 1도 같이 포함되어서 조건문을 단순화할 수 있을 것 같습니다🙌

// TC: O(log n)
// SC: O(1)
function hammingWeight(n: number): number {
const binary = n.toString(2);
Copy link
Contributor

Choose a reason for hiding this comment

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

👍👍

@junzero741 junzero741 merged commit 339aeaa into DaleStudy:main Mar 21, 2026
1 check passed
@github-project-automation github-project-automation bot moved this from Solving to Completed in 리트코드 스터디 7기 Mar 21, 2026
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.

3 participants