Skip to content

Commit 4302e92

Browse files
authored
Create 796. Rotate String
1 parent 8f06d05 commit 4302e92

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

796. Rotate String

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
class Solution {
2+
public:
3+
bool isCircularSentence(string s) {
4+
int flag = 1;
5+
for (int i = 0; i < s.size(); i++) {
6+
if (i < s.size() - 2) {
7+
if (s[i + 1] == ' ' && s[i + 2] != s[i])
8+
flag = 0;
9+
}
10+
}
11+
if (s[0] != s[s.size() - 1])
12+
flag = 0;
13+
return flag;
14+
}
15+
};

0 commit comments

Comments
 (0)