-
-
Notifications
You must be signed in to change notification settings - Fork 305
[hozzijeong] WEEK 06 solutions #2186
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.
안녕하세요! 해당 풀이도 좋지만 Hashmap를 사용하면 좀 더 간결하게 작성할 수 있을거 같아요!
/**
* @param {string} s
* @return {boolean}
*/
var isValid = function(s) {
const closeMap = {
'(': ')',
'{': '}',
'[': ']'
};
const stack = [];
for (const ch of s) {
if (ch in closeMap) {
stack.push(closeMap[ch]); // 기대되는 닫는 괄호를 push
} else {
if (stack.pop() !== ch) return false; // 닫는 괄호면 바로 비교
}
}
return stack.length === 0;
};
|
@DaleStudy 리뷰해줘 |
|
안녕하세요! 여러 문제를 깔끔하게 해결하셨네요. 특히
수고 많으셨고, 다음 리뷰도 기대하겠습니다! |
TonyKim9401
left a comment
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.
6주차 문제 풀이 고생하셨습니다.
시간, 공간 복잡도도 함께 분석이 되면 좋을것 같아요!
고생 많으셨어요. 7주차 문제 풀이도 파이팅입니다.
답안 제출 문제
작성자 체크 리스트
In Review로 설정해주세요.검토자 체크 리스트
Important
본인 답안 제출 뿐만 아니라 다른 분 PR 하나 이상을 반드시 검토를 해주셔야 합니다!