Company: ibm_29sep
Difficulty: medium
Valid Brackets Problem Description You are given an array of strings queries . Every string is made only of the six bracket characters ( , ) , [ , ] , { and } . For each string, decide whether it is valid . A string is valid when both of the following hold: Every opening bracket has a matching closing bracket of the same type. Brackets close in the correct order: a closing bracket must match the most recent opening bracket that is still unclosed. Equivalently, every closing bracket must have an earlier opening bracket of the same type to pair with, pairs must nest inside each other without crossing, and no opening bracket may be left unclosed at the end. Complete the function isValidBrackets(queries) . It receives the array queries and returns an array of strings of the same length, whose i -th element is "YES" if queries[i] is valid and "NO" otherwise. The provided main reads the input, calls the function and prints the result. Input Format The first line contains an integer q , the n