mirror of
https://github.com/aykhans/leet-code-problems.git
synced 2025-04-17 04:03:12 +00:00
Added max_score
This commit is contained in:
parent
876dff0e1c
commit
b901dc4b92
@ -67,4 +67,16 @@ class AcceptedEasy:
|
||||
x2 //= 10
|
||||
|
||||
reverse_x //= 10
|
||||
return reverse_x == x
|
||||
return reverse_x == x
|
||||
|
||||
def max_score(s: str) -> int:
|
||||
"""
|
||||
Link: https://leetcode.com/problems/maximum-score-after-splitting-a-string/
|
||||
Runtime: 47 ms
|
||||
"""
|
||||
m_score = 0
|
||||
for i in range(1, len(s)):
|
||||
score = s[:i].count('0') + s[i:].count('1')
|
||||
if s[:i].count('0') + s[i:].count('1') > m_score:
|
||||
m_score = score
|
||||
return m_score
|
||||
|
Loading…
x
Reference in New Issue
Block a user