Simple Solution In C++ | TC: O(n)
Approach:\n\n\n\n\nclass Solution {\npublic:\n    int countMatches(vector<vector<string>>& items, string ruleKey, string ruleValue) {\n        int ans = 0;\n   
**Approach:**\n\n\n\n```\nclass Solution {\npublic:\n    int countMatches(vector<vector<string>>& items, string ruleKey, string ruleValue) {\n        int ans = 0;\n        int index = 0;\n        if( ruleKey == "color" ) index = 1;\n        else if( ruleKey == "name" ) index = 2;\n        \n        for( auto it:items ){\n            if( it[index] == ruleValue ) ans++;\n        }\n        \n        return ans;\n    }\n};\n```
['C']