Skip to content

Commit cff0c5d

Browse files
committed
chore: rename char_frequency to char_count
1 parent 6cc1df1 commit cff0c5d

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/string/anagram.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ pub fn check_anagram(s: &str, t: &str) -> Result<bool, AnagramError> {
2222
let s_cleaned = clean_string(s)?;
2323
let t_cleaned = clean_string(t)?;
2424

25-
Ok(char_frequency(&s_cleaned) == char_frequency(&t_cleaned))
25+
Ok(char_count(&s_cleaned) == char_count(&t_cleaned))
2626
}
2727

2828
/// Cleans the input string by removing spaces and converting to lowercase.
@@ -58,7 +58,7 @@ fn clean_string(s: &str) -> Result<String, AnagramError> {
5858
/// # Returns
5959
///
6060
/// * A `HashMap` where the keys are characters and values are their frequencies.
61-
fn char_frequency(s: &str) -> HashMap<char, usize> {
61+
fn char_count(s: &str) -> HashMap<char, usize> {
6262
let mut freq = HashMap::new();
6363
for c in s.chars() {
6464
*freq.entry(c).or_insert(0) += 1;

0 commit comments

Comments
 (0)