-
Notifications
You must be signed in to change notification settings - Fork 0
Create 929. Unique Email Addresses.md #31
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
Conversation
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.
先に split したほうが replace の長さが減るのでは。
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.
Odaさん、ありがとうございます。
問題文の流れの通りに書いておりました。ご指摘の通りですね。
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.
oroginal_local[i] != '+' を and 条件に加えるよりも、'+' が来たら break するように書いたほうが見やすい気がします。
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.
上記実施すれば、while 文から for 文に書き換えられそうです。そうすると i を宣言する必要もないですね。
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.
説明文には引数に渡される部分が local name とあるので、address を name に変えたほうがいいと思いました。
そもそも local name の部分だけだと address としての役割は果たせないので、この単語が入ることにちょっと違和感を感じます🙏
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.
oroginal_local[i] == '.' を満たす時に continue する書き方にするのも良さそうです。
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.
Python の文字列型って immutable じゃなかったでしたっけ?あまり詳しくないので間違っていたらすいません。
もし immutable だと、この行が実行されるたびに文字列型の値が生成されてしまうので、修正したほうがいいと思います。
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.
他の方に同じコメントをしたら oda さんから返信がありました。ちゃんと見て後ほど返信しますが、仰られてる通りあまり適切でないレビューだった気がしています... すいません🙏
SuperHotDogCat/coding-interview#30 (comment)
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.
メソッドチェーンにするとデバッグがしづらくなるので、replace、split は別の行でそれぞれ処理しても良さそうです。
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.
ありがとうございます。そうですね、ちょっと見づらいと思いので、replace、splitに分けるとより良いですね。
https://leetcode.com/problems/unique-email-addresses/description/