Company: ibm_29sep
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: string queries[q]: the string 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: "{[]}" → All brackets are correctly matched and nested. "([ " → Missing closing bracket for '('. "{[]" → Brackets are properly nested and matched. ")(]" → Starts with closing bracket ')' without a match. Example 2: Input: 3 {[]}() ({]} {} Output: YES NO YES Explanation: "{[]}()" → Brackets are co