We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 53703d4 commit a9ca567Copy full SHA for a9ca567
Easy/Count Items Matching a Rule.java
@@ -0,0 +1,6 @@
1
+class Solution {
2
+ public int countMatches(List<List<String>> items, String ruleKey, String ruleValue) {
3
+ int ruleIdx = ruleKey.equals("type") ? 0 : (ruleKey.equals("color") ? 1 : 2);
4
+ return (int) items.stream().filter(item -> item.get(ruleIdx).equals(ruleValue)).count();
5
+ }
6
+}
0 commit comments