We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
/* * Complete the 'plusMinus' function below. * * The function accepts INTEGER_ARRAY arr as parameter. */fnplusMinus(arr:&[i32]){letpos_count:f64=arr.into_iter().filter(|&x|(*x>(0asi32))).count()asf64;letzero_count:f64=arr.into_iter().filter(|&x|(*x==(0asi32))).count()asf64;println!("{:.6}\n{:.6}\n{:.6}",pos_count/arr.len()asf64,(arr.len()asf64-(pos_count+zero_count))/arr.len()asf64,zero_count/arr.len()asf64,);}
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Plus Minus
You are viewing a single comment's thread. Return to all comments →