Valid Parentheses (C)
Topics: stack, string scan
Problem
bool is_valid(const char *s);
Return true if every bracket ()[]{} is closed by the correct type in the right order. Push openers
onto a stack; on a closer, it must match the top (else invalid). Valid iff the stack ends empty.
Run: cc -std=c11 -O2 -Wall tests.c -o /tmp/p && /tmp/p
Sign in to submit your solution.