String Problem

Правка en2, от In_The_Name_Of_Love, 2019-06-18 10:18:28

You're given String which consists of open and close bracket, numbers and question mark (?). Also you're given two integer M and N. M is number of plus (+) and N is number of minus (-). You'll have to replace question mark (?) with plus (+) or minus (-) and maximize the expression. You'll have to use exactly M plus (+) and N (-). It is guaranteed that M + N = Number of question mark(?).

1 <= Length of String <= 10000

Example : String : ((1?(5?7))?((6?2)?7)) M = 3, N = 2

if we put 3 plus (+) and 2 minus (-) then, ((1-(5-7))+((6+2)+7)) Answer : 18

How to tackle this Problem?

Thank you!

Теги #strings, maximize

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en2 Английский In_The_Name_Of_Love 2019-06-18 10:18:28 5 Tiny change: ' plus (+) and minus (-)' -> ' plus (+) or minus (-)'
en1 Английский In_The_Name_Of_Love 2019-06-18 10:16:05 629 Initial revision (published)