LeetCode — Flipt String to Monotone Increasing

Input: s = "00110"
Output: 1
Explanation: We flip the last digit to get 00111.
Input: s = "010110"
Output: 2
Explanation: We flip to get 011111, or alternatively 000111.
Input: s = "00011000"
Output: 2
Explanation: We flip to get 00000000.
  • 1 <= s.length <= 105
  • s[i] is either '0' or '1'.

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store