Help solving this problem asked in Amazon OA.
Difference between en1 and en2, changed 69 character(s)
I am stuck solving this problem asked in Amazon OA. Please help.↵

Given a binary string where missing values are denoted by *. Replace *s with 0s or 1s so as to achieve the minimum cost
,. You are given that cost of having "01" every subsequence in string adds x and every subsequence "10" in string adds y to the final cost. ↵

Test case are define as string, and numbers x and y respectively.↵

Finally answer should be modulo 1000000007.↵

Constraints:↵
size of string is 1 to 100000.↵
x and y are from 0 to 100000.↵

Test cases :↵

Input1↵
01*↵
2 1↵

Output1: 3↵

Input2↵
!!!!↵
6 5↵

Output2: 0↵



History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en3 English sagesofindia 2026-02-17 02:46:28 9
en2 English sagesofindia 2026-02-17 02:33:51 69
en1 English sagesofindia 2026-02-17 02:30:58 599 Initial revision (published)