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↵
↵
↵
↵
↵
Given a binary string where missing values are denoted by *. Replace *s with 0s or 1s so as to achieve the minimum 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↵
↵
↵
↵



