bumpsoo 2024-11-02 22:58:15 +09:00
parent b06692b5f2
commit ef558d6ee0

14
easy/circular_sentence.py Normal file
View file

@ -0,0 +1,14 @@
# https://leetcode.com/problems/circular-sentence
class Solution:
def isCircularSentence(self, sentence: str) -> bool:
words = sentence.split(' ')
last = words[0][len(words[0]) - 1]
for word in words[1:]:
if last != word[0]:
return False
last = word[len(word) - 1]
return last == words[0][0]