Philips Interview Question

Validate the number of brackets in a method