aboutsummaryrefslogtreecommitdiffstats
path: root/1422/main.py
blob: faf01ea27fd4f55f8286ceb6a29416e9c3d6b110 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/usr/bin/env python


class Solution:
    def maxScore(self, s: str) -> int:
        max_score = 0
        for i in range(1, len(s)):
            left = s[:i]
            right = s[i:]
            score = left.count("0") + right.count("1")
            if score > max_score:
                max_score = score
        return max_score


def main():
    solution = Solution()
    s = "011101"
    print(solution.maxScore(s))


if __name__ == "__main__":
    main()