3 ms·
The solution I posted doesn't use a stack, or any other data structures for that matter.
by kerkeslager 8y ago
The solution I posted doesn't use a stack, or any other data structures for that matter.
- user5994461 8y agoIt's easier with a stack and it avoids common mistakes from other algorithms. Also easier to generalize to follow up problems like multiple characters. Push on opening parenthesis. Pop on closing parenthesis. Trivial.