Open
Conversation
https://leetcode.com/problems/is-subsequence/ Given two strings s and t, return true if s is a subsequence of t, or false otherwise. A subsequence of a string is a new string that is formed from the original string by deleting some (can be none) of the characters without disturbing the relative positions of the remaining characters. (i.e., "ace" is a subsequence of "abcde" while "aec" is not).
oda
reviewed
Jun 3, 2024
| ``` | ||
|
|
||
|
|
||
| - while elseを使う(なんとなく聞いたことあるくらいで、よく把握していないので調べた) これは全然慣れない。結局コードを参照しながら書いて時間がかかった。慣れといた方がいいのか? |
There was a problem hiding this comment.
私も、Python native じゃないので、while else 慣れない(し自然さは感覚がない)んですが、CPython のコードなどを見ていると、たまに出てきますね。
https://github.com/python/cpython/blob/2e0aa731aebb8ef3d89ada82f5d39b1bbac65d1f/Modules/itertoolsmodule.c#L2625
Owner
Author
There was a problem hiding this comment.
コード例ありがとうございます。
見てみましたが、自分にとっては複雑でまだ処理が終えてないのでまた時間がある時に見てみます
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.
URL: https://leetcode.com/problems/is-subsequence/
Given two strings s and t, return true if s is a subsequence of t, or false otherwise.
A subsequence of a string is a new string that is formed from the original string by deleting some (can be none) of the characters without disturbing the relative positions of the remaining characters. (i.e., "ace" is a subsequence of "abcde" while "aec" is not).