2490Return ring sentence
topic:
Thought:
Divide each word,Then stitch together(123Stitch123123),Determine whether the next word corresponding to each word meets whether the next word meets the same first。
Code:
class Solution:
def isCircularSentence(self, sentence: str) -> bool:
sentence = sentence.split(' ')
length = len(sentence)
sentence += sentence
for i in range(0, length):
if sentence[i][-1] != sentence[i+1][0]:
return False
return True贡献者
这篇文章有帮助吗?
最近更新
Involution Hell© 2026 byCommunityunderCC BY-NC-SA 4.0