C++ Easy Detailed Answer and Explanations IN O(N)
class Solution {\npublic:\n    int countMatches(vector>& items, string ruleKey, string ruleValue) {\n        int count = 0;\n        for(int i=0; i<items.size()
class Solution {\npublic:\n    int countMatches(vector<vector<string>>& items, string ruleKey, string ruleValue) {\n        int count = 0;\n        for(int i=0; i<items.size(); i++) {\n            if(ruleKey=="type" and items[i][0]==ruleValue)\n                count++;\n            else if(ruleKey=="color" and items[i][1]==ruleValue)\n                count++;\n            else if(ruleKey=="name" and items[i][2]==ruleValue)\n                count++;\n        }\n        return count;\n    }\n};
['C']