Skip to content

Conversation

HC-kang
Copy link
Contributor

@HC-kang HC-kang commented Sep 18, 2024

답안 제출 문제

체크 리스트

  • PR을 프로젝트에 추가하고 Week를 현재 주차로 설정해주세요.
  • 바로 앞에 PR을 열어주신 분을 코드 검토자로 지정해주세요.
  • 문제를 모두 푸시면 프로젝트에서 Status를 In Review로 설정해주세요.
  • 코드 검토자 1분 이상으로부터 승인을 받으셨다면 PR을 병합해주세요.


for (const char of s) {
if (pairs[char]) stack.push(char);
else if (char != pairs[stack.pop()!]) return false;
Copy link
Member

Choose a reason for hiding this comment

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

안녕하세요~ 희찬님!

!= 와 !==, == 와 ===를 혼용하시는 이유가 따로 있을까요?
저는 개인적으로 얕은 비교(==, !=)의 동작을 신경쓰지 않고 엄격한 비교만 일관적으로 하기 위해 깊은 비교를 사용하는 것을 선호하고 권장하는 편이에요.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@sounmind 네 안녕하세요~ 저도 말씀하신 내용에 동의합니다.
최근 레거시 코드베이스에서 작업중이라 ==와 !=를 자주 사용하다 보니 습관적으로 얕은 비교를 사용하는 경우가 많아졌네요
덕분에 좀 더 의식하고 사용 할 수 있을 것 같습니다!

@HC-kang HC-kang marked this pull request as ready for review September 19, 2024 08:01
@HC-kang HC-kang requested a review from a team as a code owner September 19, 2024 08:01
}
node = node[word[i]];
}
return !!node['isEnd'];
Copy link
Contributor

Choose a reason for hiding this comment

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

오 js, ts 에는 이중부정(!!) 이란 게 있네요 여기에서 undefined 인 경우를 방지하기 위함이군요 ㅋㅋ 새롭네용 ㅎㅎㅎ

Copy link
Contributor

@EgonD3V EgonD3V left a 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])) {
Copy link
Contributor

Choose a reason for hiding this comment

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

string을 slice하는 로직은 그 길이만큼 시간 복잡도를 먹어서, 그 대신 index를 파라미터로 받아서 �시간복잡도를 개선할 수도 있습니다

Copy link
Contributor Author

Choose a reason for hiding this comment

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

오 그렇게 할 수 있겠네요. 감사합니다~!

@HC-kang HC-kang merged commit 189509b into DaleStudy:main Sep 20, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
No open projects
Status: Completed
Development

Successfully merging this pull request may close these issues.

4 participants