Company: Ibm_20nov
Difficulty: medium
Valid Brackets Problem Description You are given an array of strings, where each string contains only the characters '(', ')', '{', '}', '[', and ']'. For each string, determine if the string is valid. A string is valid if: * Every opening bracket has a matching closing bracket of the same type. * Brackets close in the correct order. The function `isValidBrackets` will take one input: vector queries The function should return an array of strings, where each element is "YES" if the corresponding input string is valid, or "NO" otherwise. Examples Example 1: Input: q = 4 queries = ["([])", "([]", "([])", "][()"] Output: ["YES", "NO", "YES", "NO"] Explanation: Analysis of each bracket sequence is as follows: 1. "([])" -> All brackets are correctly matched and nested. 2. "([]" -> Missing closing bracket for '('. 3. "([])" -> Brackets are properly nested and matched. 4. "][()" -> Starts with closing bracket ']' without a match. Example 2: Input: 3 [(){} {}( ) (){} Output: YES NO YES Explanat