InfinityLabs Interview Question

Verify parentheses validity, pseudocode is enough