JAVA | easy with comments |
\nclass Solution {\n    \n    // step one we will compare it rulekey and ruleValue with every element and increase the count\n    \n    public int countMatches(
```\nclass Solution {\n    \n    // step one we will compare it rulekey and ruleValue with every element and increase the count\n    \n    public int countMatches(List<List<String>> items, String ruleKey, String ruleValue) {\n       int count=0;\n        for(int i=0; i<items.size(); i++){\n            if(ruleKey.equals("type") && items.get(i).get(0).equals(ruleValue)){ //here we are traving at\n                // row 0 and into index 0 of every element of row one if it matched requirement incre count\n                count=count+1;\n            }\n            if(ruleKey.equals("color") && items.get(i).get(1).equals(ruleValue)){ //here we are traving at\n                // row 2 and into index 1 of every element of row one if it matched requirement incre count\n                count=count+1;\n            }\n            if(ruleKey.equals("name") && items.get(i).get(2).equals(ruleValue)){ //here we are traving at\n                // row 2 and into index 2 of every element of row one if it matched requirement incre count\n                count=count+1;\n            }\n        }\n        return count;\n    }\n}\n```// if you understode it than only please upvote it.. it makes me motivated to code more contribute more..
['Java']