Skip to content

Conversation

jdalma
Copy link
Member

@jdalma jdalma commented Sep 10, 2024

답안 제출 문제

체크 리스트

  • PR을 프로젝트에 추가하고 Week를 현재 주차로 설정해주세요.
  • 바로 앞에 PR을 열어주신 분을 코드 검토자로 지정해주세요.
  • 문제를 모두 푸시면 프로젝트에서 Status를 In Review로 설정해주세요.
  • 코드 검토자 1분 이상으로부터 승인을 받으셨다면 PR을 병합해주세요.

@jdalma jdalma requested a review from ijlijijij September 10, 2024 03:55
@jdalma jdalma requested a review from a team as a code owner September 10, 2024 03:55
3sum/jdalma.kt Outdated

/**
* 2. 입력받은 정수 배열을 정렬하여 순회하면서 원소를 합산하여 0과 비교한 결과를 기준으로 투 포인터의 값을 조작한다.
* TC: O(n * log(n) + n^2), SC: O(n)
Copy link
Contributor

@bky373 bky373 Sep 12, 2024

Choose a reason for hiding this comment

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

n 이 커지면 n^2 항이 n log n 항보다 훨씬 더 빠르게 증가하고 n log n 영향력이 줄기 때문에,
이런 경우 TC 를 O(n^2) 으로 적는 게 더 일반적인 것 같습니다!

Copy link
Member Author

Choose a reason for hiding this comment

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

아 그렇군요 ㅎㅎ 이렇게 시간 복잡도를 나열하는 것이 맞나 생각했었는데 가장 영향력이 큰 것만 골라적어야하는군요 ㅎㅎ 감사합니당

Copy link
Contributor

@ijlijijij ijlijijij left a comment

Choose a reason for hiding this comment

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

고생하셨습니다!

}

/**
* 2. 카데인 알고리즘의 변형된 버전으로 가장 싼 경우를 buy에 저장하고 현재 최대 수익을 초과하면 업데이트한다
Copy link
Contributor

Choose a reason for hiding this comment

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

이 방식을 카데인 알고리즘으로 부르는군요! 배웠습니다!


/**
* 2. 입력받은 문자열들을 순회하며 문자열의 문자 갯수를 카운트하여 애너그램인지 구별한다.
* TC: O(n), SC: O(n)
Copy link
Contributor

Choose a reason for hiding this comment

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

배열을 사용한 방법도 있었군요!

Copy link
Contributor

@ijlijijij ijlijijij Sep 13, 2024

Choose a reason for hiding this comment

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

위에 k처럼, 이것도 O(n*k)일 것 같습니다!

Copy link
Member Author

@jdalma jdalma Sep 14, 2024

Choose a reason for hiding this comment

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

아 그렇네요 ㅎㅎ 감사합니당


/**
* 3. 문자열의 끝부터 0까지 순회하면서 순회하는 범위의 문자열을 만들 수 있다면 해당 인덱스를 true로 변환하여 이전에 사용한 연산의 결과를 재활용한다.
* TC: O(s * w * wordDict 단어의 길이) TC: O(s)
Copy link
Contributor

Choose a reason for hiding this comment

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

SC 오타 있습니다!


/**
* 1. DFS 사용 (시간초과)
* TC: O(s^w * wordDict 단어의 길이), SC: O(s)
Copy link
Contributor

@ijlijijij ijlijijij Sep 13, 2024

Choose a reason for hiding this comment

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

최악의 경우, 각 인덱스에서 w번 모두 선택할 수 있다고 생각해서 w * w * w *.... = w^s라고 이해했는데요
s^w로 표현된 이유도 혹시 설명해주실 수 있을까요? 궁금해서 여쭤봅니다. 😊

Copy link
Member Author

Choose a reason for hiding this comment

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

아 맞네요 ㅎㅎ 말씀하신 s^w가 맞는 것 같습니다 ㅎㅎ w 길이만큼 s 길이까지 재귀호출을 하니 말씀하신게 맞는 것 같아요 수정하겠습니당

@jdalma jdalma merged commit 004452c into DaleStudy:main Sep 14, 2024
1 check 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