LeetCode LeetCode 2022-05-31 1773. Count Items Matching a Rule 文章目录 1. 题目2. 思路 题目 https://leetcode.com/problems/count-items-matching-a-rule/ 思路太困了所以直接暴力解 1234567891011class Solution: def countMatches(self, items, ruleKey, ruleValue): count=0 for i in items: if (ruleKey == "type" and i[0] == ruleValue): count+=1 elif (ruleKey == "color" and i[1] == ruleValue): count+=1 elif(ruleKey == "name" and i[2] == ruleValue): count+= 1 return count