String Problem

Revision en1, by In_The_Name_Of_Love, 2019-06-18 10:16:05

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 (+) and 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!

Tags #strings, maximize

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en2 English In_The_Name_Of_Love 2019-06-18 10:18:28 5 Tiny change: ' plus (+) and minus (-)' -> ' plus (+) or minus (-)'
en1 English In_The_Name_Of_Love 2019-06-18 10:16:05 629 Initial revision (published)