NeuroBlade interview question

check valid paranthesis in java