0

Hi I have a String like --String S="{({)}}"-- I want to write logic where if a bracket opens it should be closed in that sequence if not return false.

For e.g 1. S="{({)}}" it is "true" as { bracket got closed in correct sequence manner.

2.S="{([)}]" it is false as "[" should have been closed before "}"

  • 2
    https://stackoverflow.com/questions/16874176/parenthesis-brackets-matching-using-stack-algorithm – jspcal May 21 '18 at 05:55
  • Are you sure your first example is correct? `{({)}}` does not look "closed in correct sequence manner" to me – k_ssb May 21 '18 at 06:00

0 Answers0