MCPcopy Create free account
hub / github.com/StudyRust/leetcode_rust / main

Function main

1773-count-items-matching-a-rule.rs:5–18  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

3// 著作权归领扣网络所有。商业转载请联系官方授权,非商业转载请注明出处。
4
5fn main() {
6 let items = vec!(
7 vec!("phone","blue","pixel"),
8 vec!("computer","silver","lenovo"),
9 vec!("phone","gold","iphone")).into_iter().map(|a|
10 a.into_iter().map(|b|
11 b.to_string()
12 ).collect()
13 ).collect();
14 let rule_key = "color".to_string();
15 let rule_value = "silver".to_string();
16 let res = count_matches(items, rule_key, rule_value);
17 println!("{:?}", res);
18}
19
20pub fn count_matches(items: Vec<Vec<String>>, rule_key: String, rule_value: String) -> i32 {
21 let mut res = 0;

Callers

nothing calls this directly

Calls 1

count_matchesFunction · 0.85

Tested by

no test coverage detected