You are viewing a single comment's thread. Return to all comments →
Rust solution using a hashmap to not waste time on already verified characters.
let mut analyzed_chars = std::collections::HashSet::new(); let mut tallest_char_height = 0; for char in word.to_ascii_lowercase().chars() { if analyzed_chars.contains(&char) { continue; } analyzed_chars.insert(char); let char_height: i32 = h[char as usize - 97]; if char_height > tallest_char_height { tallest_char_height = char_height; } } return word.len() as i32 * tallest_char_height;
Seems like cookies are disabled on this browser, please enable them to open this website
Designer PDF Viewer
You are viewing a single comment's thread. Return to all comments →
Rust solution using a hashmap to not waste time on already verified characters.