Walmart Global Tech interview question

Valid paranthesis