C++ Simple and Easy 3-Line Solution
First we find which index in the item should match the ruleValue.\nThen we can easily compare.\n\nclass Solution {\npublic:\n    int countMatches(vector<vector<
First we find which index in the item should match the `ruleValue`.\nThen we can easily compare.\n```\nclass Solution {\npublic:\n    int countMatches(vector<vector<string>>& items, string ruleKey, string ruleValue) {\n        int res = 0, key = ruleKey == "type" ? 0 : ruleKey == "color" ? 1 : 2;\n        for (auto item : items) if (item[key] == ruleValue) res++;\n        return res;\n    }\n};\n```\n**Like it? please upvote!**
['C']