-
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
[Helena] Week 1 solutions #48
Conversation
마지막 줄에 line break를 추가해주시면 좋을것 같습니다...! |
각 풀이의 시간복잡도와 공간복잡도 도 적어주시면 좋을것 같습니다...! |
반영하였습니다, 감사합니다 :) |
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.
수고하셨습니다. @dev-jonghoonpark의 피드백처럼 복잡도 분석도 해주시면 더욱 좋을 것 같네요 😄
secondList = t.split("").sort(); | ||
|
||
// compare if these are same and return | ||
return JSON.stringify(firstList) === JSON.stringify(secondList); |
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.
솔루션 잘 봤습니다! 저도 처음 문제를 풀었을 때 sort 해서 비교하는 방식으로 문제를 풀었었는데요. 해당 방법이 간단하고 원라인코드로 작성가능한 점은 좋으나 sort 때문에 시간복잡도가 n logn이 되는 단점이 있습니다! 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.
수고하셨습니다 👍👍
주석으로 설명들을 많이 남겨주셔서 이해가 잘되었어요!
리뷰어분들의 이해를 돕기 위해 주석을 쓰시는 건가요? 저는 평소에 거의 주석을 안달아서 궁금하네요!!
firstList = s.split("").sort(); | ||
secondList = t.split("").sort(); |
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.
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.
저는 Set
을 이용하여 문자가 몇 번 등장했는지 유지한 후 비교하도록 했어요~
Set
을 사용하는 건 정렬보다 낮은 시간복잡도라는 장점이 있을 것 같아요!
Included as follows :