Skip to content

Conversation

hyejjun
Copy link
Contributor

@hyejjun hyejjun commented Aug 20, 2024

  1. Valid Anagram
    시간 복잡도: O(n)
    공간 복잡도: O(n)

  2. Counting Bits
    시간 복잡도: O(n * log n)
    공간 복잡도: O(n)

@hyejjun hyejjun marked this pull request as draft August 20, 2024 03:34
@hyejjun hyejjun added the js label Aug 20, 2024
@DaleSeo
Copy link
Member

DaleSeo commented Aug 21, 2024

  • Valid Anagram
    시간 복잡도: O(n)
    공간 복잡도: O(n)
  • Counting Bits
    시간 복잡도: O(n * log n)
    공간 복잡도: O(n)

복잡도 분석은 코드에(도) 주석으로 남겨주시면 리뷰하시는 분들이 더 편할 것 같습니다.

@hyejjun hyejjun marked this pull request as ready for review August 23, 2024 23:13
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.

수고하셨습니다!

@DaleSeo DaleSeo requested a review from seona926 August 24, 2024 00:03
console.log(countBits(5));

/*
시간 복잡도: O(n * log n)
Copy link
Member

Choose a reason for hiding this comment

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

안녕하세요~ 어떤 이유로 시간 복잡도가 n log n 이 나오는지, 여기서 n은 무엇을 가리키는지 설명해주시면 더 좋을 것 같아요! 나중에 실제 코딩 테스트 면접에서도 도움이 될 거라고 생각합니다 ☺️

Comment on lines +7 to +11
let result = [];

for (let i = 0; i <= n; i++) {

let binary = i.toString(2);
Copy link
Member

@sounmind sounmind Aug 24, 2024

Choose a reason for hiding this comment

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

Suggested change
let result = [];
for (let i = 0; i <= n; i++) {
let binary = i.toString(2);
�const result = [];
for (let i = 0; i <= n; i++) {
const binary = i.toString(2);

저는 재할당 되지 않을 변수는 const 키워드로 선언하는 편인데요. 이는 코드를 읽는 사람으로 하여금 이 변수는 재할당되지 않을 것임을 예측할 수 있도록 해주고, 나중에 실수로 해당 변수에 다른 값을 할당하게 되는 버그를 사전에 예방할 수 있기 때문이에요.

@DaleSeo DaleSeo merged commit 3e1d624 into DaleStudy:main Aug 25, 2024
1 of 2 checks 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