Skip to content

[김한기] - Week 4 solutions #87

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

Merged
merged 1 commit into from
May 24, 2024
Merged

[김한기] - Week 4 solutions #87

merged 1 commit into from
May 24, 2024

Conversation

meoooh
Copy link
Contributor

@meoooh meoooh commented May 21, 2024

No description provided.

@meoooh meoooh removed their assignment May 21, 2024
@DaleSeo
Copy link
Member

DaleSeo commented May 22, 2024

PR 제목을 보니 주차가 햇갈리신 것 같아요!
Shot 2024-05-21 at 20 50 38@2x

@meoooh meoooh changed the title [김한기] - Week 3 solutions [김한기] - Week 4 solutions May 22, 2024
@meoooh
Copy link
Contributor Author

meoooh commented May 22, 2024

그러네요! 수정할게요

Copy link
Member

@DaleSeo DaleSeo left a comment

Choose a reason for hiding this comment

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

수고하셨습니다! 복잡도 분석도 추가해주시면 코드 리뷰에 도움이 될 것 같습니다.

# @param {Integer} n, a positive integer
# @return {Integer}
def reverse_bits(n)
# 이유는 모르겠으나 문제 설명과는 달리 leetcode 루비 테스트코드에선 n이 10진수 Integer로 들어오네요.
Copy link
Member

Choose a reason for hiding this comment

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

다른 언어에서도 마찬가지에요. 문제가 좀 오해가 소지가 있게 설명이 되어 있는 것 같아요 😅

Comment on lines +4 to +5
Enum.map(0..n, fn i ->
Integer.digits(i, 2) |> Enum.count(&(&1 != 0))
Copy link
Member

Choose a reason for hiding this comment

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

시간 복잡도가 $O(n * log n)$이 될 것 같은데, 빨리 제출하셨으니 $O(n)$ 솔루션도 고민해보시면 좋을 것 같습니다.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

제가 사실 시간복잡도 공간복잡도 개념이 익숙치 않은데 공부해야겠네요 ^^;

Copy link
Contributor

Choose a reason for hiding this comment

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

코딩 인터뷰에서 시공간 복잡도 분석이 필요한 걸로 알고 있는데 맞을까요?

defmodule Solution do
@spec missing_number(nums :: [integer]) :: integer
def missing_number(nums) do
(0..length(nums) |> Enum.to_list) -- nums |> Enum.at(0)
Copy link
Member

Choose a reason for hiding this comment

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

신기한 연산자가 많네요. 언어별 특징이 보이는 것 같아 보는 맛이 있네요 ㅎㅎ

@leokim0922 leokim0922 merged commit e86ad1e into DaleStudy:main May 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Status: Done
Development

Successfully merging this pull request may close these issues.

5 participants