Skip to content

Conversation

easyone-jwlee
Copy link
Contributor

@easyone-jwlee easyone-jwlee commented Dec 15, 2024

답안 제출 문제

체크 리스트

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

// O(n)

// SC
// data type이 int인 변수만 사용했으므로 O(1)
Copy link
Contributor

@obzva obzva Dec 19, 2024

Choose a reason for hiding this comment

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

사소한 피드백입니다 :)
제 생각엔 조금 더 정확한 표현을 하자면 아래처럼 쓰는게 더 맞을 것 같아요

Suggested change
// data type이 int인 변수만 사용했으므로 O(1)
// 해당 알고리즘의 추가적인 공간 사용량은 n에 상관 없이 일정하므로 O(1) (n: input으로 주어진 string `s`의 길이)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

피드백 감사합니다. 앞으로는 좀 더 정확한 표현으로 적어보겠습니다^ㅡ^

// SC
// s의 길이만큼 늘어나는 map으로 인해 O(n)

func isAnagram(s string, t string) bool {
Copy link
Contributor

Choose a reason for hiding this comment

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

anagram의 속성을 이용하여 앞단에서 false를 더 빠르게 반환하는 로직이 추가되면 더 좋을 것 같아요 :)
가령 인풋으로 아래와 같은 string들이 주어지면 map 관련 연산을 하는데 불필요한 시간이 많이 들거든요

s = "aaa...aaa"   (길이 5 * 10^4)
r = "bbb...bbb"  (길이 5 * 10^4)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

오 그 생각을 못했네요. 감사합니다.

Comment on lines +19 to +20
var recursive func(rootIndex, inStart, inEnd int) *TreeNode
recursive = func(rootIndex, inStart, inEnd int) *TreeNode {
Copy link
Contributor

Choose a reason for hiding this comment

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

처음 Go로 문제 풀어볼 당시에 closure 함수를 어떻게 선언해야 하지.. 고민이 많았는데 잘 구현하셨네요 ㅎㅎ
혹시 Go를 현업에서 쓰고 계신가요?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

네 현업에서 Go를 사용해서 개발하고 있습니다. 연차에 비해 알고리즘 실력이 좋지 못해서 부단히 노력중입니다;;^ㅡ^

Copy link
Contributor

@obzva obzva left a comment

Choose a reason for hiding this comment

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

문제 풀이도 깔끔하고 설명도 명료한 것 같습니다 수고하셨습니다 :)

@easyone-jwlee easyone-jwlee merged commit 36cfe67 into DaleStudy:main Dec 19, 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.

2 participants