-
-
Notifications
You must be signed in to change notification settings - Fork 195
[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
[Arthur] Week 1 #626
Conversation
저희 스터디에 새로운 Gopher가 오시다니, 환영합니다! |
} | ||
} | ||
return false | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
마지막 줄에 개행문자를 삽입해주세요
workflow를 통과하지 못하고 있습니다 :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
앗 제가 몰랐네요... 수정했습니다!
} | ||
|
||
return maxConsecutiveCount | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
마지막 줄에 개행문자를 삽입해주세요
workflow를 통과하지 못하고 있습니다 :)
There was a problem hiding this comment.
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{} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
make
함수로 미리 slice의 사이즈를 할당해두면 N이 큰 경우에 더 효율적일 것 같습니다 :)
resultNums := []int{} | |
resultNums := make([]int{}, 0, len(result)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
capacity를 미리 정해서 메모리 재할당이 적어지니까 더 효율적이겠네요 ㅎㅎ 확인 감사합니다! 수정했습니다.
valid-palindrome/changchanghwang.go
Outdated
regex, _ := regexp.Compile("[a-zA-Z0-9]") | ||
reverseAndFilteredString := "" | ||
filteredString := "" | ||
|
||
for _, char := range s { | ||
if regex.MatchString(string(char)) { | ||
c := strings.ToLower(string(char)) |
There was a problem hiding this comment.
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()
를 적용시키는 것이 더 깔끔한 코드가 될 것 같습니다
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)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
앗 아무생각없이 짰더니 저런 안좋은 코드가 나왔네요.. ㅎㅎ 수정했습니다 감사합니다!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
아이구 안 좋은 코드는 아니에요!!!
reverseAndFilteredString = c + reverseAndFilteredString | ||
filteredString += c |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
제가 알기로는 strings
패키지의 strings.Builder
struct를 사용하는 것이 더 효과적인 것으로 알고 있습니다 :)
참고링크
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
오... 제가 고퍼가 된지 얼마 되지 않아 몰랐습니다!! 수정했습니다. 다만 reverseAndFilteredString의 경우 strings.Builder를 사용하게되면 로직이 조금더 복잡해지기도 하고 가독성이 조금 안좋아지지 않을까 하여 filteredString만 수정했습니다 :)
valid-palindrome/changchanghwang.go
Outdated
} | ||
|
||
return reverseAndFilteredString == filteredString | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
마지막 줄에 개행문자를 삽입해주세요
workflow를 통과하지 못하고 있습니다 :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
앗 제가 몰랐네요... 수정했습니다!
@changchanghwang 님, 디스코드 닉네임이 어떻게 되시나요? 답안 제출 가이드를 보면 PR 제목에 본인의 디스코드 닉네임을 포함 시켜달라고 되어 있는데, 현재 제목에 포함됟어 있는 |
앗 제가 디스코드닉네임이 아니라 깃허브 닉네임을 붙혔군요;; 수정했습니다. 죄송합니다! |
sort.Slice(result, func(i, j int) bool { // go의 sort는 quicksort를 기본적으로 사용한다. O(nlogn) | ||
return result[i][1] > result[j][1] | ||
}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
go를 처음 본 입장에서, sort 알고리즘 주석 넣으신 부분 도움되네요.
감사합니다.
There was a problem hiding this comment.
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>
답안 제출 문제
체크 리스트
In Review
로 설정해주세요.