-
-
Notifications
You must be signed in to change notification settings - Fork 195
[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
base: main
Are you sure you want to change the base?
Conversation
// 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); |
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.
Map에서 값을 가져올 때 항상 존재한다고 가정하는 !
보다, 옵셔널 체이닝
+ nullish coalescing
사용이 안전할 것 같아요 :)
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.
아, 그렇군요. 알려주셔서 감사합니다.
let scale: number = 1; | ||
|
||
while (stack.length > 0) { | ||
output += stack.pop()! * scale; |
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.
!
사용보다는 stack.pop() || 0
이나, 길이 체크 후 사용이 더 안전할 것 같아요 :)
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.
네, 설명 감사합니다! 타입스크립트가 정적 타입 체크 기반이라는 걸 잘 몰랐을 때는, 런타임에선 항상 안전하다고 생각해서 !만 써서 넘겼던 것 같아요. 이제는 좀 더 안전하게 처리해보겠습니다. 😊
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 | ||
*/ |
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.
자바스크립트의 비트 연산 특성과 32비트 정수 변환 과정을 자세히 설명한 점이 좋았어요! 👍
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.
이번 한주도 고생 많으셨어요! 다음주도 화이팅입니다 👍👍
답안 제출 문제
작성자 체크 리스트
In Review
로 설정해주세요.검토자 체크 리스트
Important
본인 답안 제출 뿐만 아니라 다른 분 PR 하나 이상을 반드시 검토를 해주셔야 합니다!