Skip to content

Practice Circular Sentence

Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.

Easy#2490
LeetCode Problem

Circular Sentence

Problem Statement

Words in sentence are separated by single spaces. Return whether the last character of each word equals the first character of the next word, including the last word connecting back to the first. Character comparisons are case-sensitive.

Source: Circular Sentence on LeetCode. Use the original task for its coding environment and submissions.

Examples

# Example 1

Input
sentence = "leetcode exercises sound delightful"
Output
true

# Example 2

Input
sentence = "eetcode"
Output
true

# Example 3

Input
sentence = "Leetcode is cool"
Output
false

Constraints

1 <= sentence.length <= 500
sentence consist of only lowercase and uppercase English letters and spaces.
The words in sentence are separated by a single space.
There are no leading or trailing spaces.

Related LeetCode Problems

Practice more problems similar to Circular Sentence.

Review your practice with PhantomCodeAI

After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.