HTMLify

LeetCode - Maximum Score After Splitting a String - Python
Views: 23 | Author: abh
class Solution:
    def maxScore(self, s: str) -> int:
        maxscore = 0
        for i in range(1, len(s)):
            l = s[:i]
            r = s[i:]
            score = l.count("0") + r.count("1")
            if score > maxscore:
                maxscore = score
        return maxscore

Comments