Skip to content

[Jeehay28] Week 08 Solutions #1493

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

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open

[Jeehay28] Week 08 Solutions #1493

wants to merge 6 commits into from

Conversation

Jeehay28
Copy link
Contributor

@Jeehay28 Jeehay28 commented May 19, 2025

답안 제출 문제

작성자 체크 리스트

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

검토자 체크 리스트

Important

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

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

// Shrink the sliding window by moving the left pointer to the right.
// As we move left, decrease the frequency count of the character being excluded from the window.
const ch = s[left];
freqMap.set(ch, freqMap.get(ch)! - 1);
Copy link
Contributor

Choose a reason for hiding this comment

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

Map에서 값을 가져올 때 항상 존재한다고 가정하는 ! 보다, 옵셔널 체이닝 + nullish coalescing 사용이 안전할 것 같아요 :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

아, 그렇군요. 알려주셔서 감사합니다.

let scale: number = 1;

while (stack.length > 0) {
output += stack.pop()! * scale;
Copy link
Contributor

Choose a reason for hiding this comment

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

! 사용보다는 stack.pop() || 0이나, 길이 체크 후 사용이 더 안전할 것 같아요 :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

네, 설명 감사합니다! 타입스크립트가 정적 타입 체크 기반이라는 걸 잘 몰랐을 때는, 런타임에선 항상 안전하다고 생각해서 !만 써서 넘겼던 것 같아요. 이제는 좀 더 안전하게 처리해보겠습니다. 😊

3. If you need the result as a 32-bit unsigned integer (like for LeetCode problems dealing with uint32):
- Use >>> 0 at the end of your result
- This forces the result to be treated as an unsigned 32-bit integer
*/
Copy link
Contributor

Choose a reason for hiding this comment

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

자바스크립트의 비트 연산 특성과 32비트 정수 변환 과정을 자세히 설명한 점이 좋았어요! 👍

@Jeehay28 Jeehay28 moved this from Solving to In Review in 리트코드 스터디 4기 May 23, 2025
Copy link
Contributor

@clara-shin clara-shin left a comment

Choose a reason for hiding this comment

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

이번 한주도 고생 많으셨어요! 다음주도 화이팅입니다 👍👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: In Review
Development

Successfully merging this pull request may close these issues.

2 participants