diff options
Diffstat (limited to '1422')
-rwxr-xr-x | 1422/main.py | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/1422/main.py b/1422/main.py new file mode 100755 index 0000000..faf01ea --- /dev/null +++ b/1422/main.py @@ -0,0 +1,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() |