Amazon Interview Question

Balanced braces, another Tree based question