-
-
Notifications
You must be signed in to change notification settings - Fork 195
[선재] WEEK 03 #391
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
[선재] WEEK 03 #391
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.
복잡도 분석에 대한 피드백이 있지만 승인하는데 문제가 없는 것 같습니다. 수고 많으셨습니다!
class CustomQueue { | ||
constructor() { | ||
this.front = null; | ||
this.rear = null; | ||
this.size = 0; | ||
} | ||
|
||
push(val) { | ||
const node = new Node(val); | ||
|
||
if (this.size === 0) { | ||
this.front = node; | ||
this.rear = node; | ||
} else { | ||
this.rear.next = node; | ||
this.rear = node; | ||
} | ||
|
||
this.size++; | ||
} | ||
|
||
pop() { | ||
if (this.size === 0) return null; | ||
const node = this.front; | ||
this.front = this.front.next; | ||
this.size--; | ||
if (this.size === 0) this.rear = null; | ||
|
||
return node.value; | ||
} | ||
} |
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.
맞아요 ㅠㅠ
자바스크립트는 자료구조가 많이 빈약한 언어라 따로 구현할수 밖에 없더라구요...
그래도 이렇게 구현�하니 자료구조 경험치가 쌓이는거 같아서 좋네요 :)
two-sum/sunjae95.js
Outdated
/** | ||
* @description brainstorming 1 solve | ||
* time complexity: O(n^2) | ||
* space complexity: O(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.
입력 크기에 비례해서 메모리를 쓰는 부분이 없는 것 같은데요?
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.
nums 자체가 계산에서 존재해서 공간복잡도가 O(n)라고 착각했네요. 계산중 사용하는 공간은 공간이 2인 배열이기에 공간복잡도는 O(1)이 되겠네요!
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.
수고하셨습니다!
* brainstorming: | ||
* 1. asc sort + division calculate | ||
* 2. bfs + memoization | ||
* | ||
* strategy: | ||
* bfs + memoization | ||
* | ||
* reason: | ||
* Tried with brainstorming 1 but test case is 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.
이런 내용 정말 좋은 것 같네요 ㅎㅎ 저도 작성해봐야겠네요
} | ||
|
||
var coinChange = function (coins, amount) { | ||
const queue = new CustomQueue(); |
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.
저는 개인적으로 DP를 굉장히 못 풀어서 DP로 풀 수 있는 문제같으면 답안을 꼭 참고하는 편입니다 ㅎㅎ
이 문제는 DP에서 베이직한 문제라고 소개되고 있어서 괜찮으시면 해설 영상 추천드려요 혹시 DP에 익숙하시면 신경안쓰셔도 됩니당 ㅎㅎ
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.
DP 초보인데 레퍼런스 감사합니다!
다양한 방법으로 생각하면서 풀어봐야겠네요!
답안 제출 문제
체크 리스트
In Review
로 설정해주세요.