-
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
[정현준] 2주차 답안 제출 #347
[정현준] 2주차 답안 제출 #347
Conversation
jdalma
commented
Aug 19, 2024
- Valid Anagram #218
- Counting Bits #233
- Encode and Decode Strings #238
- Construct Binary Tree From Preorder And Inorder Traversal #253
- Decode Ways #268
* preorder : 현재(부모) 노드부터 왼쪽 자식 노드, 오른쪽 자식 노드 | ||
* inorder : 왼쪽 자식 노드 부터 부모 노드, 오른쪽 자식 노드 | ||
*/ | ||
fun buildTree(preorder: IntArray, inorder: IntArray): TreeNode? { |
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.
안녕하세요 현준님
이 문제에 대해서도 Big-O analysis를 추가해주시면 좋을 것 같습니다 :D
return dp | ||
} | ||
|
||
// 3. 최하위 비트를 제거한 결과를 재활용한다. (최하위 비트를 제거한 결과) + (현재 십진수의 최하위비트) |
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.
이 방법 너무 좋은 것 같습니다 :D
} | ||
|
||
/** | ||
* 4. 배열을 사용하지 않고 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.
이 풀이도 정말 좋네요
memoisation 배열의 모든 값이 필요하지 않다는 점을 잘 캐치하신 것 같습니다
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.
알고달레 중독자 발견! 💉
@Test | ||
fun `문자열 목록을 하나의 문자열로 인코딩한다`() { | ||
encode(listOf("leet","co:de","l:o:v:e","you")) shouldBeEqual "4:leet5:co:de7:l:o:v:e3:you" | ||
} | ||
|
||
@Test | ||
fun `문자열을 문자열 목록으로 디코딩한다`() { | ||
decode("4:leet5:co:de7:l:o:v:e3:you") shouldBeEqual listOf("leet","co:de","l:o:v:e","you") | ||
} |
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.
테스트 케이스가 아주 적절하네요! 💯
Co-authored-by: Dale Seo <5466341+DaleSeo@users.noreply.github.com>
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.