Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 611588a

Browse files
fix: add alternate syntax to get entry from map
Signed-off-by: rajput-hemant <rajput.hemant2001@gmail.com>
1 parent 659a6fd commit 611588a

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

‎src/0201-0300/242 - Valid Anagram/valid_anagram.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@ impl Solution {
88
}
99

1010
let s_map = s.chars().fold(HashMap::new(), |mut map, c| {
11-
// *map.entry(c).or_insert(0) = map.get(&c).unwrap_or(&0) + 1;
11+
// let count = map.entry(c).or_insert(0);
12+
// *count += 1;
13+
1214
// same as above
1315
*map.entry(c).or_insert(0) += 1;
1416
map

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /