Expedia Group interview question

Stacks and check valid parenthese