-
-
Notifications
You must be signed in to change notification settings - Fork 195
[Sehwan]Week2 solutions with JavaScript #58
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
Conversation
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.
네네 이렇게 만들어보니까 링크드 리스트에 대한 이해도가 조금 더 올라가는 것 같아요 ㅎㅎ
// If it is an open bracket, push the close bracket into stack array | ||
if (char === "(") stack.push(")"); | ||
else if (char === "{") stack.push("}"); | ||
else if (char === "[") stack.push("]"); | ||
// If it is not an open bracket, compare last element of stack array | ||
else if (char !== 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.
감사합니다. 🙏
No description provided.