forked from fishercoder1534/Leetcode
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path_1773.java
More file actions
21 lines (19 loc) · 699 Bytes
/
_1773.java
File metadata and controls
21 lines (19 loc) · 699 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
package com.fishercoder.solutions;
import java.util.List;
public class _1773 {
public static class Solution1 {
public int countMatches(List<List<String>> items, String ruleKey, String ruleValue) {
int match = 0;
for (List<String> item : items) {
if (ruleKey.equals("type") && item.get(0).equals(ruleValue)) {
match++;
} else if (ruleKey.equals("color") && item.get(1).equals(ruleValue)) {
match++;
} else if (ruleKey.equals("name") && item.get(2).equals(ruleValue)) {
match++;
}
}
return match;
}
}
}