Tap here to switch tabs
Problem
Submissions

Problem: Circular Sentence

med
30 min
Try to solve the Circular Sentence problem.

Statement

A sentence is a list of words separated by a single space, where each word consists of uppercase and lowercase English letters.

A sentence is considered circular if:

  • The last character of each word is equal to the first character of the following word.

  • The last character of the last word is equal to the first character of the first word.

Given a string sentence, determine whether it is circular. Return true if it is circular, or false otherwise.

Constraints:

  • 1≤1 \leq sentence.length ≤500\leq 500

  • sentence consists 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.

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Circular Sentence

med
30 min
Try to solve the Circular Sentence problem.

Statement

A sentence is a list of words separated by a single space, where each word consists of uppercase and lowercase English letters.

A sentence is considered circular if:

  • The last character of each word is equal to the first character of the following word.

  • The last character of the last word is equal to the first character of the first word.

Given a string sentence, determine whether it is circular. Return true if it is circular, or false otherwise.

Constraints:

  • 1≤1 \leq sentence.length ≤500\leq 500

  • sentence consists 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.