Ad

speed up

Code
Diff
  • fn verify_sum(name_one: &str, name_two: &str) -> bool {
        sum(name_one) == sum(name_two)
    }
    
    fn sum(name: &str) -> u32 {
        let mut prod = 0;
        for b in name.bytes(){
            prod += b as u32;
        }  
        prod
    }
    • fn verify_sum(name_one: &str, name_two: &str) -> bool {
    • sum(name_one) == sum(name_two)
    • }
    • fn sum(name: &str) -> u32 {
    • name.chars().map(u32::from).sum()
    • let mut prod = 0;
    • for b in name.bytes(){
    • prod += b as u32;
    • }
    • prod
    • }