Closed
Conversation
usatie
reviewed
Sep 19, 2024
usatie
left a comment
There was a problem hiding this comment.
良いと思います!nitコメントでしかないですが、つけておきました。個人的には二周した方が好きです。このくらいで面倒臭いですかね・・・?
| */ | ||
| func longestPalindrome(s string) int { | ||
| length := 0 | ||
| frequencies := make(map[rune]int, len(s)) |
There was a problem hiding this comment.
keyが存在しないか1かしかないので、frequenciesという名前が正しくはないような気もします。
frequenciesという名前なら1週目はカウントだけしてほしいかも。
Kitaken0107
reviewed
Sep 21, 2024
| */ | ||
| func longestPalindrome(s string) int { | ||
| length := 0 | ||
| frequencies := make(map[rune]int, len(s)) |
| /* | ||
| 時間:6分 | ||
|
|
||
| 1周目はカウントだけして、2周目にlengthを求めるという方法も取れると思うが、for文を2つ書くのがめんどくさかった(計算量的にはどちらも大差ないと思う)ので1周で収めるようにした。 |
There was a problem hiding this comment.
1周目はカウントだけして、2周目にlengthを求めるという方法も取れると思う
これが一番自然な方法な気がしていて、
これに言及した上で別の観点で他の方法を選択しているのが良いと思いました。
There was a problem hiding this comment.
私は1周目で単にカウントして2周目で計算するでしょう。そのほうが読みやすいと思うので。
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Longest Palindromeを解きました。レビューをお願いいたします。
問題:https://leetcode.com/problems/longest-palindrome/
言語:Go
既に解いた方々:
NobukiFukui/Grind75-ProgrammingTraining#31
Kitaken0107/GrindEasy#27