My name is Siz. I am a computer science graduate student specializing in backend development with Golang and Python, seeking opportunities in innovative tech projects. My personal website is longsizhuo.com .Connect with me on LinkedIn: https://www.linkedin.com/in/longsizhuo/.
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:
1 2 3 4 5 6 7 8 9
classSolution: defisCircularSentence(self, sentence: str) -> bool: sentence = sentence.split(' ') length = len(sentence) sentence += sentence for i inrange(0, length): if sentence[i][-1] != sentence[i+1][0]: returnFalse returnTrue