Just had oa yesterday and unable to solve any of it (Criedddddd
Is there anyone can help to solve or give some hints?

Example:
"10001" 1 operation since s[1:3] can be flipped
"1010" 2 operation coz "1010" -> "1001" -> "1111"

Example 2:
Input: 23:59
Output : 22:22 coz cannot find the next so use the 2 to replace all


Thanks a lot if you can help!