akshitverma209's blog

By akshitverma209, history, 8 years ago, In English

Can anyone help me in my code. I am getting WA and m not able to rectify it plzzz my code : http://ideone.com/DkrwIg problem link : http://www.spoj.com/problems/BRCKTS/

  • Vote: I like it
  • -1
  • Vote: I do not like it

»
8 years ago, # |
  Vote: I like it 0 Vote: I do not like it

When you make a replacement, you change only one element and it's wrong. You have to change the balance of brackets on segment [pos...n]. If the current bracket is "(", you have to add 1 to each element on the segment and -1 otherwise.