Chubb Interview Question

solution for brackets are valid or not.