Chubb interview question

solution for brackets are valid or not.