# what is approach of solving MINUS on SPOJ?

I have an Idea, after doing n-1 operations one can see that there is just + and - coefficients before each number that matters. For eg. given sequence: 12 10 4 3 5 and we need to make it a mathematical expression using + and - signs only to get 4 ,one solution will be +12-10+4+3-5 = 4 ,this expression (+12-10+4+3-5) is get by using knapsack dp, so the exact sign sequence (+)12(-)10(+)4(+)2(-)5 i.e. +-++- is the required signs sequence and at first stage (+)12(+)10(+)4(+)3(+)5 i.e. +++++ how to get +-++- and what should be sequence of operations?

• The question should be self-contained. What is your question exactly? – Evil Jun 17 '17 at 12:42
• I don't know how to get sequence of operations on converting sequence +++++ to +-++- – Śȟůbȟäm Ŗäĵpůț Jun 17 '17 at 13:14
• how to decide which sets too be merged at the moment ,say instead of (+)(+)(+)(+)(+) -> (+)(+-)(+)(+) If I do (+)(+)(+)(+)(+) ->(+-)(+)(+)(+) ->(+-)(+)(+-) answer woudnt be same as operations are less than n-1. – Śȟůbȟäm Ŗäĵpůț Jun 17 '17 at 13:14
• Could you edit your question to include that info? Also the self-contained means that the body of the question should be in your post, not in any external server. – Evil Jun 17 '17 at 13:43
• I want to make it as clear as possible but plz read this answer also: quora.com/… – Śȟůbȟäm Ŗäĵpůț Jun 18 '17 at 4:55