The TransCompilator

Solved LeetCode program · 692 of 1,000

#0926 · Flip String to Monotone Increasing

Medium String chunk-14.md

Original English source

The source is "00110". The ones is 0. The flips is 0.
For every spot from 0 to the last position of source.
The symbol is the slice of source from spot to spot plus 1. If symbol is "1", add 1 to ones. If symbol is "0", add 1 to flips. If flips is more than ones, set flips to ones.

Report flips.

Open in Playground Browse all 1,000 problems

Expected stdout

1