Get Minimum Errors

Problem Overview

  • Given a binary string with '0', '1', and '!' placeholders, choose each '!' as 0 or 1 to minimize total errors.
  • An '01' subsequence adds x errors and a '10' subsequence adds y errors; return the minimum errors modulo 1e9+7.
  • Input: errorString, integers x and y; Output: minimal error count as int.
  • Domain: data integrity in Amazon's database; classic coding interview problem and interview question.
  • Asked in Amazon interviews; constraints: 1 ≤ |s| ≤ 1e5, 0 ≤ x,y ≤ 1e5.

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: