LeetCodeCount Items Matching a RuleCount Items Matching a RuleEasyArrayStringSolution export function countMatches(items: string[][], ruleKey: string, ruleValue: string): number { const itemIndex = ruleKey === 'type' ? 0 : ruleKey === 'color' ? 1 : 2; return items.filter((item) => item[itemIndex] === ruleValue).length; }LeetCodeCount Items Matching a Rulehttps://leetcode.com/problems/count-items-matching-a-rule