Find Lucky Integer in an Array LeetCode solution in Rust
1use std::collections::HashMap;2impl Solution {3pub fn find_lucky(arr: Vec<i32>) -> i32 {4let mut hm = HashMap::new();56for i in arr {7*hm.entry(i).or_insert(0) += 1;8}9let mut max = -1;10for (key, value) in hm {11if key == value && key > max {12max = key;13}14}15max16}17}