Get Minimum Operations
Implement a function that returns the minimum number of operations needed to ensure the string s (of length n) contains no segments of exactly m consecutive '0's.
In one operation, you can do the following:
- Select a contiguous segment of length
kand make every bit in this segment '1'.
The function getMinOperations will take three inputs:
- string
s: a string representings. - int
m: an integer representingm. - int
k: an integer representingk.
The function should return an integer representing the minimum number of operations needed.
Example
Unlock to view complete problem details
and practice with sample input/output
Was this article helpful?
View Test Cases & Run Code requires membership
Input Variables
Execution Result:
