Minimum Weighted Errors From Wildcards

Asked at Amazon · Coding Questions · Difficulty: Medium

A string `errorString` contains '0', '1', and '!' (each '!' may become '0' or '1'). Every subsequence "01" costs `x` and every subsequence "10" costs `y`. Choose the '!' replacements to minimize the total cost; return it modulo `1_000_000_007`.

Loading the problem…