Pregunta de entrevista de Thoughtworks

Coding ques- write a program to find if a arithmetic expression is valid or not.