✅Java Simple Solution || ✅Runtime 2ms
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution {\n    public int countMatches(List<List<String>> items, String ruleKey, String ruleValue) {\n        int count = 0 ;\n        int index = (ruleKey.equals("type"))? 0: (ruleKey.equals("color"))? 1 : 2;\n\n        for (List list : items )\n        {\n            if (list.get(index).equals(ruleValue)) count++;\n        }\n        return count;\n    }\n}\n```\n\n## For additional problem-solving solutions, you can explore my repository on GitHub: [GitHub Repository](https://github.com/ahmedna126/java_leetcode_challenges)\n\n\n![abcd1.jpeg](https://assets.leetcode.com/users/images/dfb18a48-10ff-427b-bd29-9b55031a4f1a_1699958088.8775723.jpeg)\n
['Java']