1
2
3
4
5
6
7
8
9
10
11
|
class Solution:
def countMatches(self, items: List[List[str]], ruleKey: str, ruleValue: str) -> int:
cnt=0
for i in items:
if ruleKey=='type':
if i[0]==ruleValue:cnt+=1
if ruleKey=='color':
if i[1]==ruleValue:cnt+=1
if ruleKey=='name':
if i[2]==ruleValue:cnt+=1
return cnt
|
cs |
반응형
'python-algorithm' 카테고리의 다른 글
Leetcode 1791. Find Center of Star Graph (0) | 2021.07.16 |
---|---|
Leetcode 1221. Split a String in Balanced Strings (0) | 2021.07.16 |
Leetcode 1678. Goal Parser Interpretation (0) | 2021.07.16 |
Leetcode 1389. Create Target Array in the Given Order (0) | 2021.07.16 |
Leetcode 1342. Number of Steps to Reduce a Number to Zero (0) | 2021.07.15 |
댓글