Skip to content

Conversation

limlimjo
Copy link
Contributor

@limlimjo limlimjo commented Dec 24, 2024

답안 제출 문제

체크 리스트

  • 우측 메뉴에서 PR을 Projects에 추가해주세요.
  • Projects의 오른쪽 버튼(▼)을 눌러 확장한 뒤, Week를 현재 주차로 설정해주세요.
  • 바로 앞에 PR을 열어주신 분을 코드 검토자로 지정해주세요.
  • 문제를 모두 푸시면 프로젝트에서 StatusIn Review로 설정해주세요.
  • 코드 검토자 1분 이상으로부터 승인을 받으셨다면 PR을 병합해주세요.

@limlimjo limlimjo requested a review from paragon0107 December 24, 2024 14:52
@limlimjo limlimjo requested a review from a team as a code owner December 24, 2024 14:52
@github-actions github-actions bot added the js label Dec 24, 2024
@limlimjo limlimjo changed the title two sum solution [jj7779607] Week3 Dec 24, 2024
Comment on lines +7 to +16
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]);
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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('');

이렇게 하는 건 어떨까요?

Copy link
Contributor Author

@limlimjo limlimjo Dec 26, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

훨씬 간결하네요. 감사합니다!

return null;
};

// 첫 번째 푼 방법보다 공간 복잡도가 늘어났지만 시간 복잡도는 줄어듦
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍👍

Copy link
Contributor

@SamTheKorean SamTheKorean left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

이번주도 문제 푸시느라 고생많으셨습니다!

@limlimjo limlimjo merged commit 01a5fd8 into DaleStudy:main Dec 29, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
No open projects
Status: Completed
Development

Successfully merging this pull request may close these issues.

3 participants