[dahyeong-yun] WEEK 06 Solutions - #2783
Open
dahyeong-yun wants to merge 6 commits into
Open
Conversation
Contributor
📊 dahyeong-yun 님의 학습 현황이번 주 제출 문제
누적 학습 요약
문제 풀이 현황
🤖 이 댓글은 GitHub App을 통해 자동으로 작성되었습니다. 🔢 API 사용량 (gpt-5-nano)
|
dolphinflow86
self-requested a review
July 30, 2026 00:05
| stack.push(c); | ||
| } else { | ||
| // 닫는 괄호의 경우 stack이 비어있으면 안됨 | ||
| if(stack.size() < 1) return false; |
Contributor
There was a problem hiding this comment.
사소하지만, stack에 isEmtpy()가 있다면 사용하시면 좀 더 가독성이 좋을 것 같아요.
Comment on lines
+23
to
+25
| if((peek == '(' && c == ')') | ||
| || (peek == '{' && c == '}') | ||
| || (peek == '[' && c == ']') |
Contributor
There was a problem hiding this comment.
저도 리뷰 받은 사항인데, map에 key, value로 여는괄호 닫는괄호 쌍을 넣어두고 체크하면 코드가 매우 깔끔해질 것 같습니다.
| public boolean isValid(String s) { | ||
| Deque<Character> stack = new ArrayDeque<>(); | ||
|
|
||
| for(char c : s.toCharArray()) { |
Contributor
There was a problem hiding this comment.
찾아보니 toCharArray가 내부적으로 문자열을 복제헤서 새로 만든다고 하네요.
인덱스 접근으로 s.chatAt(i) 처럼 하시면 불필요한 연산을 줄이실 수 있을 것 같습니다.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
답안 제출 문제
작성자 체크 리스트
In Review로 설정해주세요.검토자 체크 리스트
Important
본인 답안 제출 뿐만 아니라 다른 분 PR 하나 이상을 반드시 검토를 해주셔야 합니다!