Skip to content

[Arthur] Week 1 #626

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 12 commits into from
Dec 10, 2024
Merged

[Arthur] Week 1 #626

merged 12 commits into from
Dec 10, 2024

Conversation

changchanghwang
Copy link
Contributor

@changchanghwang changchanghwang commented Dec 3, 2024

답안 제출 문제

체크 리스트

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

@obzva
Copy link
Contributor

obzva commented Dec 3, 2024

저희 스터디에 새로운 Gopher가 오시다니, 환영합니다!

}
}
return false
}
Copy link
Contributor

Choose a reason for hiding this comment

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

마지막 줄에 개행문자를 삽입해주세요
workflow를 통과하지 못하고 있습니다 :)

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 maxConsecutiveCount
}
Copy link
Contributor

Choose a reason for hiding this comment

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

마지막 줄에 개행문자를 삽입해주세요
workflow를 통과하지 못하고 있습니다 :)

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 result[i][1] > result[j][1]
})

resultNums := []int{}
Copy link
Contributor

Choose a reason for hiding this comment

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

make함수로 미리 slice의 사이즈를 할당해두면 N이 큰 경우에 더 효율적일 것 같습니다 :)

Suggested change
resultNums := []int{}
resultNums := make([]int{}, 0, len(result))

Copy link
Contributor Author

Choose a reason for hiding this comment

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

capacity를 미리 정해서 메모리 재할당이 적어지니까 더 효율적이겠네요 ㅎㅎ 확인 감사합니다! 수정했습니다.

Comment on lines 7 to 13
regex, _ := regexp.Compile("[a-zA-Z0-9]")
reverseAndFilteredString := ""
filteredString := ""

for _, char := range s {
if regex.MatchString(string(char)) {
c := strings.ToLower(string(char))
Copy link
Contributor

Choose a reason for hiding this comment

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

c := strings.ToLower(string(char))

char 하나씩 string()함수로 타입 변환하여 strings.ToLower()함수를 적용하는 것보다는, 입력으로 주어진 전체 문자열 s를 통째로 strings.ToLower()를 적용시키는 것이 더 깔끔한 코드가 될 것 같습니다

Suggested change
regex, _ := regexp.Compile("[a-zA-Z0-9]")
reverseAndFilteredString := ""
filteredString := ""
for _, char := range s {
if regex.MatchString(string(char)) {
c := strings.ToLower(string(char))
s = strings.ToLower(s)
regex, _ := regexp.Compile("[a-zA-Z0-9]")
reverseAndFilteredString := ""
filteredString := ""
for _, char := range s {
if regex.MatchString(string(char)) {

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.

아이구 안 좋은 코드는 아니에요!!!

Comment on lines +14 to +15
reverseAndFilteredString = c + reverseAndFilteredString
filteredString += c
Copy link
Contributor

Choose a reason for hiding this comment

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

제가 알기로는 strings 패키지의 strings.Builder struct를 사용하는 것이 더 효과적인 것으로 알고 있습니다 :)
참고링크

Copy link
Contributor Author

Choose a reason for hiding this comment

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

오... 제가 고퍼가 된지 얼마 되지 않아 몰랐습니다!! 수정했습니다. 다만 reverseAndFilteredString의 경우 strings.Builder를 사용하게되면 로직이 조금더 복잡해지기도 하고 가독성이 조금 안좋아지지 않을까 하여 filteredString만 수정했습니다 :)

}

return reverseAndFilteredString == filteredString
}
Copy link
Contributor

Choose a reason for hiding this comment

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

마지막 줄에 개행문자를 삽입해주세요
workflow를 통과하지 못하고 있습니다 :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

앗 제가 몰랐네요... 수정했습니다!

@DaleSeo
Copy link
Member

DaleSeo commented Dec 3, 2024

@changchanghwang 님, 디스코드 닉네임이 어떻게 되시나요?

답안 제출 가이드를 보면 PR 제목에 본인의 디스코드 닉네임을 포함 시켜달라고 되어 있는데, 현재 제목에 포함됟어 있는 changchanghwang라는 닉네임이 디스코드에서 검색되지 않아서 문의드립니다.

@changchanghwang changchanghwang changed the title [changchanghwang] Week 1 [Arthur] Week 1 Dec 4, 2024
@changchanghwang
Copy link
Contributor Author

@changchanghwang 님, 디스코드 닉네임이 어떻게 되시나요?

답안 제출 가이드를 보면 PR 제목에 본인의 디스코드 닉네임을 포함 시켜달라고 되어 있는데, 현재 제목에 포함됟어 있는 changchanghwang라는 닉네임이 디스코드에서 검색되지 않아서 문의드립니다.

앗 제가 디스코드닉네임이 아니라 깃허브 닉네임을 붙혔군요;; 수정했습니다. 죄송합니다!

Comment on lines +19 to +21
sort.Slice(result, func(i, j int) bool { // go의 sort는 quicksort를 기본적으로 사용한다. O(nlogn)
return result[i][1] > result[j][1]
})
Copy link
Contributor

Choose a reason for hiding this comment

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

go를 처음 본 입장에서, sort 알고리즘 주석 넣으신 부분 도움되네요.
감사합니다.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

하핳.. 저도 궁금해서 찾아봤는데 저렇다고 하더라구요 ㅎㅎ..

Co-authored-by: Chaedong Im <chaedong.im.dev@gmail.com>
@changchanghwang changchanghwang merged commit f9dc342 into DaleStudy:main Dec 10, 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.

4 participants