Chatham Financial interview question

Paranthesis validation