-
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
[pepper] Week 6 Solutions #479
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.
이번 한 주도 고생 많으셨습니다~!
@@ -0,0 +1,39 @@ | |||
function spiralOrder(matrix: number[][]): number[] { |
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.
크 복잡한 조건이나 visited 같은 부수적인게 하나도 없는 깔끔한 코드네요 👍
} | ||
|
||
// TC: O(m*n) | ||
// SC: O(m*n) |
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.
Space complexity가 O(m*n)인 이유가 혹시 ans
배열 때문일까요?
보통 return하는 정답 객체는 공간 복잡도에 포함시키지 않는 것으로 알고 있습니다 :)
const lastOpenChar = openCharStack.pop(); | ||
if (lastOpenChar !== pair) { | ||
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.
stack이 비어 있는 경우도 처리해주어야 하지 않나 싶었는데, JS에선 빈 배열을 pop할 때 undefined를 반환한다는 사실 덕분에 알아 갑니다 ㅎㅎ
Co-authored-by: Dongyeong Chon <dngyng1000@gmail.com>
답안 제출 문제
체크 리스트
In Review
로 설정해주세요.