文章作者:Tyan
博客:noahsnail.com | 优快云 | 简书
1. Description

2. Solution
**解析:**根据对应的索引比较对应的值即可。
- Version 1
class Solution:
def countMatches(self, items: List[List[str]], ruleKey: str, ruleValue: str) -> int:
index = 0
if ruleKey == 'color':
index = 1
elif ruleKey == 'name':
index = 2
count = 0
for item in items:
if item[index] == ruleValue:
count += 1
return count

被折叠的 条评论
为什么被折叠?



