-
Notifications
You must be signed in to change notification settings - Fork 126
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
[강희찬] WEEK 6 Solution #468
Conversation
|
||
for (const char of s) { | ||
if (pairs[char]) stack.push(char); | ||
else if (char != pairs[stack.pop()!]) return false; |
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.
안녕하세요~ 희찬님!
!= 와 !==, == 와 ===를 혼용하시는 이유가 따로 있을까요?
저는 개인적으로 얕은 비교(==, !=)의 동작을 신경쓰지 않고 엄격한 비교만 일관적으로 하기 위해 깊은 비교를 사용하는 것을 선호하고 권장하는 편이에요.
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.
@sounmind 네 안녕하세요~ 저도 말씀하신 내용에 동의합니다.
최근 레거시 코드베이스에서 작업중이라 ==와 !=를 자주 사용하다 보니 습관적으로 얕은 비교를 사용하는 경우가 많아졌네요
덕분에 좀 더 의식하고 사용 할 수 있을 것 같습니다!
} | ||
node = node[word[i]]; | ||
} | ||
return !!node['isEnd']; |
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.
오 js, ts 에는 이중부정(!!
) 이란 게 있네요 여기에서 undefined
인 경우를 방지하기 위함이군요 ㅋㅋ 새롭네용 ㅎㅎㅎ
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.
수고하셨습니다
for (let i = 0; i < word.length; i++) { | ||
if (word[i] === '.') { | ||
for (const key in node) { | ||
if (this.dfs(word.slice(i + 1), node[key])) { |
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.
string을 slice하는 로직은 그 길이만큼 시간 복잡도를 먹어서, 그 대신 index를 파라미터로 받아서 �시간복잡도를 개선할 수도 있습니다
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
로 설정해주세요.