LeetCode solutions

2580. Circular Sentence

My accepted Python solution to LeetCode problem 2580, Circular Sentence, running in 0ms.

  • Difficulty: Easy
  • Python
  • Runtime 0ms
  • Memory 17.6MB

Read the problem on LeetCode View on GitHub

Python

Accepted on LeetCode — runtime 0ms, memory 17.6MB, accepted 2025-12-31.

python
class Solution:
    def isCircularSentence(self, sentence: str) -> bool:
        words = sentence.split()
        n = len(words)
        for i in range(n):
            if words[i][-1] != words[(i + 1) % n][0]:
                return False
        return True

Source