Skip to content

Commit 0d8c747

Browse files
committed
chore: add daily leetcode post [2490]回环句_translated
1 parent a7d109d commit 0d8c747

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
---
2+
title: 2490Return ring sentence
3+
date: '2024.01.01 0:00'
4+
tags:
5+
- - Python
6+
- - answer
7+
- - String
8+
abbrlink: 5c07686c
9+
---
10+
11+
# topic:
12+
13+
[[2490]Return ring sentence.md](https://leetcode.cn/problems/circular-sentence/)
14+
15+
# Thought:
16+
17+
Divide each word,Then stitch together(`123`Stitch`123123`),Determine whether the next word corresponding to each word meets whether the next word meets the same first。
18+
19+
# Code:
20+
21+
```python
22+
class Solution:
23+
def isCircularSentence(self, sentence: str) -> bool:
24+
sentence = sentence.split(' ')
25+
length = len(sentence)
26+
sentence += sentence
27+
for i in range(0, length):
28+
if sentence[i][-1] != sentence[i+1][0]:
29+
return False
30+
return True
31+
```

0 commit comments

Comments
 (0)