Trains the technique from
LeetCode 1422Maximum Score After Splitting a StringThis is an original problem, written from a brief that listed the technique, the difficulty, the topics, the function shape and the input bounds — none of that problem's wording, examples, hints or editorials. The link is there so you can map your practice onto the standard set.
Same function shape, different story and different numbers.
A strip marks holds only the characters 0 and 1. Cut it once into a left piece and a right piece, and neither piece may be empty.
A cut scores the number of 0 characters in the left piece plus the number of 1 characters in the right piece.
Return the highest score a cut can reach.
Example 1
Cutting after the two zeros puts both of them on the left and both ones on the right, scoring 2 plus 2.
Example 2
Only one cut is possible. The left piece is a single 1 and the right piece a single 0, so neither side scores anything.
Example 3
Cutting where the zeros run out puts all five zeros on the left and all five ones on the right.
The editor is preloaded with this. It matches the parent problem's shape, so a solution that works here transfers to a judge unchanged.
def max_score(marks: str) -> int:public int maxScore(String marks)See the step-by-step animation, the intuition, and clean code in every language — free, no credit card.