1-1
Let 𝑛 be a positive integer. Mario has a binary string∗ 𝑠 of length 𝑛 . In one move, he can choose any position 𝑖 (2≤𝑖≤𝑛−1 ) such that it's between two 1's, i.e., 𝑠𝑖−1=𝑠𝑖+1=𝟷 , and then set 𝑠𝑖 to either 0 or 1. Mario can perform this operation as many times as he wants (possibly zero). What's the minimum and maximum number of 1's that can be in the resulting string? ∗ A binary
HINT LADDERno hints yet
L1 Observation
L2 Technique
L3 Approach
L4 Pseudo-code
🔒
L5 Full solution
L5 unlocks only if you insist twice
solution.cppC++17
CodeSearch Tutor
Hints, not spoilers — it won’t hand over the full solution unless you insist.
Sign in to chat with the tutor and save your progress.
Sign in to start