Python dict Solution
\nclass Solution(object):\n    def countMatches(self, items, ruleKey, ruleValue):\n        item_dict = {"type":0,"color":1,"name":2}\n        idx = item_dict[ru
```\nclass Solution(object):\n    def countMatches(self, items, ruleKey, ruleValue):\n        item_dict = {"type":0,"color":1,"name":2}\n        idx = item_dict[ruleKey]\n        count = 0\n        \n        for i in items:\n            if i[idx] == ruleValue:\n                count += 1\n        \n        return count\n```\n\nRuntime: 180 ms, faster than 99.71% of Python online submissions for Count Items Matching a Rule.\nMemory Usage: 21.1 MB, less than 61.76% of Python online submissions for Count Items Matching a Rule.\n\n
['Python']