Skip to content

Commit 15cf658

Browse files
add 1773
1 parent 027efb4 commit 15cf658

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ _If you like this project, please leave me a star._ ★
88

99
| # | Title | Solutions | Video | Difficulty | Tag
1010
|-----|----------------|---------------|--------|-------------|-------------
11+
|1773|[Count Items Matching a Rule](https://leetcode.com/problems/count-items-matching-a-rule/)|[Solution](../master/src/main/java/com/fishercoder/solutions/_1773.java) ||Easy|Array, String|
1112
|1769|[Minimum Number of Operations to Move All Balls to Each Box](https://leetcode.com/problems/minimum-number-of-operations-to-move-all-balls-to-each-box/)|[Solution](../master/src/main/java/com/fishercoder/solutions/_1769.java) ||Medium|Array, Greedy|
1213
|1768|[Merge Strings Alternately](https://leetcode.com/problems/merge-strings-alternately/)|[Solution](../master/src/main/java/com/fishercoder/solutions/_1768.java) ||Easy|String|
1314
|1765|[Map of Highest Peak](https://leetcode.com/problems/map-of-highest-peak/)|[Solution](../master/src/main/java/com/fishercoder/solutions/_1765.java) ||Medium|BFS, Graph|
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
package com.fishercoder.solutions;
2+
3+
import java.util.List;
4+
5+
public class _1773 {
6+
public static class Solution1 {
7+
public int countMatches(List<List<String>> items, String ruleKey, String ruleValue) {
8+
int match = 0;
9+
for (List<String> item : items) {
10+
if (ruleKey.equals("type") && item.get(0).equals(ruleValue)) {
11+
match++;
12+
} else if (ruleKey.equals("color") && item.get(1).equals(ruleValue)) {
13+
match++;
14+
} else if (ruleKey.equals("name") && item.get(2).equals(ruleValue)) {
15+
match++;
16+
}
17+
}
18+
return match;
19+
}
20+
}
21+
}

0 commit comments

Comments
 (0)