Amazon interview question

Balanced braces, another Tree based question