Skip to content

Conversation

neverlish
Copy link
Contributor

@neverlish neverlish commented Jan 28, 2025

답안 제출 문제

체크 리스트

  • 우측 메뉴에서 PR을 Projects에 추가해주세요.
  • Projects의 오른쪽 버튼(▼)을 눌러 확장한 뒤, Week를 현재 주차로 설정해주세요.
  • 바로 앞에 PR을 열어주신 분을 코드 검토자로 지정해주세요.
  • 문제를 모두 푸시면 프로젝트에서 StatusIn Review로 설정해주세요.
  • 코드 검토자 1분 이상으로부터 승인을 받으셨다면 PR을 병합해주세요.

@neverlish neverlish requested a review from limlimjo January 28, 2025 01:50
@neverlish neverlish requested a review from a team as a code owner January 28, 2025 01:50
@github-actions github-actions bot added the go label Jan 28, 2025
Copy link
Contributor

@HC-kang HC-kang left a comment

Choose a reason for hiding this comment

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

@neverlish 님, 8주차도 고생 많으셨습니다~
코드가 깔끔하고 명확해서 go를 잘 모르는데도 잘 이해할 수 있었던것 같습니다!

벌써 절반이 넘었는데, 앞으로도 좋은 풀이 많이 공유해주시면 좋겠습니다.
새해 복 많이 받으시고, 남은 휴일도 편안히 보내세요!!

@@ -0,0 +1,27 @@
// 시간복잡도: O(1)
Copy link
Contributor

Choose a reason for hiding this comment

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

carry 가 발생하는 경우에는 O(log n)의 복잡도가 필요할 것으로 보여요
ex) 0b1111 + 0b1

Copy link
Contributor Author

Choose a reason for hiding this comment

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

요건 몰랐던 사실인데 덕분에 배워갑니다 😄

for window_end < len(s) {
counter[s[window_end]]++

for window_end-window_start+1-maxValue(counter) > k {
Copy link
Contributor

Choose a reason for hiding this comment

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

maxValue(counter)에서 추가적인 시간복잡도로 O(k)가 발생할 것으로 보여요

Copy link
Contributor Author

Choose a reason for hiding this comment

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

요건 코드를 다시 훑어보았는데,
문제 제약사항 중 0 <= k <= s.length 가 있어서,

O(k)를 더한다고 해도 O(2n) 보다 커지지 않을거 같아서, O표기법에 따라서 그대로 O(n) 으로 둘까 하는데 어떨까요

commonSubsequence[i] = make([]int, len(text2)+1)
}

for i := 1; i < len(text1)+1; i++ {
Copy link
Contributor

Choose a reason for hiding this comment

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

이 이하에서는 commonSubsequence[i-1] 미만의 변수는 사실상 더이상 사용되지 않는것 같아요. 이를 덜어내는 방식으로 공간복잡도 최적화가 가능하지 않을까요?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

생각해보니 이전, 현재 포인터만 저장하면 되겠네요!

return cloneNode
}

func cloneGraph(node *Node) *Node {
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 Author

Choose a reason for hiding this comment

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

요거는 제가 빼먹었네요 ㅎㅎ 감사합니다

@neverlish
Copy link
Contributor Author

병합해보겠습니다!

@neverlish neverlish merged commit 8f5dc77 into DaleStudy:main Feb 1, 2025
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.

2 participants