Basic Recursion, Check Balanced Parenthesis

前端 未结 12 1205
孤独总比滥情好
孤独总比滥情好 2020-11-29 17:56

I\'ve written software in the past that uses a stack to check for balanced equations, but now I\'m asked to write a similar algorithm recursively to check for properly neste

12条回答
  •  自闭症患者
    2020-11-29 18:08

    I would say this depends on your design. You could either use two counters or stack with two different symbols or you can handle it using recursion, the difference is in design approach.

提交回复
热议问题