Skip to content

Commit

Permalink
Create e1422.py
Browse files Browse the repository at this point in the history
  • Loading branch information
Zanger67 authored Jan 1, 2025
1 parent 3fbe2fa commit 37e0959
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions my-submissions/e1422.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
class Solution:
def maxScore(self, s: str) -> int:
left_zeros, right_ones = 0, s.count('1')
maxx = 0

for c in s[:-1] :
if c == '0' :
left_zeros += 1
else :
right_ones -= 1
maxx = max(maxx, left_zeros + right_ones)

return maxx

0 comments on commit 37e0959

Please sign in to comment.