Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 55de8a1

Browse files
Update 1704.py
1 parent ae5e710 commit 55de8a1

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

‎1501-2000/1704.py‎

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,22 @@ def halvesAreAlike(self, s: str) -> bool:
1010
count -= 1
1111

1212
return count==0
13+
14+
15+
class Solution:
16+
def halvesAreAlike(self, s: str) -> bool:
17+
def is_vowel(x):
18+
v = "aeiouAEIOU"
19+
return x in v
20+
21+
c = 0
22+
for i in range(len(s)//2):
23+
if is_vowel(s[i]):
24+
c+=1
25+
if is_vowel(s[len(s)-i-1]):
26+
c-=1
27+
28+
return c==0
29+
30+
31+

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /