|Count the frequency of each character in a string....|General Coding Problems

fn char_frequency(s: &str) -> Vec<(char, usize)>

Easy

Count the frequency of each character in a string.

fn char_frequency(s: &str) -> Vec<(char, usize)>

Asked in

tcs

Examples

Example 1:
Input: hello
Output: {"h":1,"e":1,"l":2,"o":1}
Example 2:
Input: aabb
Output: {"a":2,"b":2}
Submit Result

Click Run to test sample cases, or Submit to evaluate all cases