-
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
[jj7779607] Week3 #777
[jj7779607] Week3 #777
Conversation
let nString = n.toString(2).padStart(32, "0"); | ||
//console.log(nString); | ||
|
||
// 스택 생성 (스택은 나중에 들어온게 먼저 나가므로) | ||
let stack = []; | ||
|
||
// nString 스택에 넣기 | ||
for (let i = 0; i < nString.length; i++) { | ||
stack.push(nString[i]); | ||
} |
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.
let nString = n.toString(2).padStart(32, "0"); | |
//console.log(nString); | |
// 스택 생성 (스택은 나중에 들어온게 먼저 나가므로) | |
let stack = []; | |
// nString 스택에 넣기 | |
for (let i = 0; i < nString.length; i++) { | |
stack.push(nString[i]); | |
} | |
const stack = n.toString(2).padStart(32, "0").split(''); |
이렇게 하는 건 어떨까요?
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.
훨씬 간결하네요. 감사합니다!
return null; | ||
}; | ||
|
||
// 첫 번째 푼 방법보다 공간 복잡도가 늘어났지만 시간 복잡도는 줄어듦 |
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.
이번주도 문제 푸시느라 고생많으셨습니다!
답안 제출 문제
체크 리스트
In Review
로 설정해주세요.