Description
Given an array items where each item is [type, color, name], count items matching the given ruleKey and ruleValue.
Examples
Input:
items = [["phone","blue","pixel"],["computer","silver","lenovo"]], ruleKey = "color", ruleValue = "silver"Output:
1Explanation:
Only lenovo matches.
Input:
items = [[1]], ruleKey = "color", ruleValue = "silver"Output:
1Explanation:
With a single item, checking its attribute against the rule yields 1 match.
Input:
items = [["laptop","black","dell"],["mouse","white","logitech"],["keyboard","black","corsair"],["monitor","black","samsung"]], ruleKey = "color", ruleValue = "black"Output:
3Explanation:
Three items match the rule: laptop (black dell), keyboard (black corsair), and monitor (black samsung). The mouse is white so it doesn't match.
Constraints
- •
1 ≤ items.length ≤ 10^4