Expedia Group Interview Question

Stacks and check valid parenthese