Help solving this problem asked in Amazon OA.

Правка en1, от sagesofindia, 2026-02-17 02:30:58

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, given 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.

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

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en3 Английский sagesofindia 2026-02-17 02:46:28 9
en2 Английский sagesofindia 2026-02-17 02:33:51 69
en1 Английский sagesofindia 2026-02-17 02:30:58 599 Initial revision (published)