Skip to content

[DaleSeo] WEEK 03 Solutions#2721

Merged
DaleSeo merged 1 commit into
DaleStudy:mainfrom
DaleSeo:week3
Jul 10, 2026
Merged

[DaleSeo] WEEK 03 Solutions#2721
DaleSeo merged 1 commit into
DaleStudy:mainfrom
DaleSeo:week3

Conversation

@DaleSeo

@DaleSeo DaleSeo commented Jul 9, 2026

Copy link
Copy Markdown
Member

답안 제출 문제

작성자 체크 리스트

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

검토자 체크 리스트

Important

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

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

@dalestudy

dalestudy Bot commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

📊 DaleSeo 님의 학습 현황

이번 주 제출 문제

문제 난이도 유형 분석
number-of-1-bits Easy ✅ 의도한 유형

누적 학습 요약

  • 풀이한 문제: 2 / 75개
  • 이번 주 유형 일치율: 100% (1문제 중 1문제 일치)

문제 풀이 현황

카테고리 진행도 완료
Heap ■■□□□□□ 1 / 3 (Medium 1)
Array ■□□□□□□ 1 / 10 (Medium 1)
Binary □□□□□□□ 0 / 5 ← 아직 시작 안 함
Dynamic Programming □□□□□□□ 0 / 11 ← 아직 시작 안 함
Graph □□□□□□□ 0 / 8 ← 아직 시작 안 함
Interval □□□□□□□ 0 / 5 ← 아직 시작 안 함
Linked List □□□□□□□ 0 / 6 ← 아직 시작 안 함
Matrix □□□□□□□ 0 / 4 ← 아직 시작 안 함
String □□□□□□□ 0 / 10 ← 아직 시작 안 함
Tree □□□□□□□ 0 / 14 ← 아직 시작 안 함

🤖 이 댓글은 GitHub App을 통해 자동으로 작성되었습니다.

🔢 API 사용량 (gpt-5-nano)
요청 입력 토큰 출력 토큰 합계 비용
1 291 54 345 $0.000036

@parkhojeong parkhojeong left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

수고하셨습니다 :)

Comment on lines +3 to +12
impl Solution {
pub fn hamming_weight(n: i32) -> i32 {
let mut n = n as u32;
let mut cnt = 0;
while n != 0 {
n &= n - 1;
cnt += 1;
}
cnt
}

@parkhojeong parkhojeong Jul 10, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

오 Brian Kernighan algorithm이라고도 불리는 방식이군요!

rust에선 count_ones()를 사용하면 cpu 의 popcount 가 지원되는 경우 명령어 사이클을 더 줄일 수도 있는 거 같네요 :)

@DaleSeo
DaleSeo merged commit 0ded189 into DaleStudy:main Jul 10, 2026
3 checks passed
@github-project-automation github-project-automation Bot moved this from In Review to Completed in 리트코드 스터디 8기 Jul 10, 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.

2 participants