Given a binary string s and two integers encCost and flatCost, determine the minimum cost to partition s.
A string or substring can be evaluated as follows:
If the segment contains no '1' characters, its cost is flatCost.
If the segment contains at least one '1' character, its cost is $ ext{length} imes k imes$ encCost, where $ ext{length}$ is the length of the segment and '1' characters in it.
Additionally, whenever a segment has an even length, it can either be kept as a single unit with the cost calculated above, or divided into two equal contiguous halves. If divided, the total cost for that segment is the sum of the minimum costs of its two halves.
Return the minimum total cost required to process the entire string s.
Constraints:
s.length
s consists only of '0' and '1'.
encCost, flatCost
Given a binary string s and two integers encCost and flatCost, determine the minimum cost to partition s.
A string or substring can be evaluated as follows:
If the segment contains no '1' characters, its cost is flatCost.
If the segment contains at least one '1' character, its cost is $ ext{length} imes k imes$ encCost, where $ ext{length}$ is the length of the segment and '1' characters in it.
Additionally, whenever a segment has an even length, it can either be kept as a single unit with the cost calculated above, or divided into two equal contiguous halves. If divided, the total cost for that segment is the sum of the minimum costs of its two halves.
Return the minimum total cost required to process the entire string s.
Constraints:
s.length
s consists only of '0' and '1'.
encCost, flatCost