Sha256: 03cffb3c9fd167b681472982589591fd678ce2653a56fb07e094d3864a24c8ef
Contents?: true
Size: 245 Bytes
Versions: 143
Compression:
Stored size: 245 Bytes
Contents
pub fn hamming_distance(a : &str, b: &str) -> Result<usize, &'static str> { if a.len() != b.len() { return Result::Err("inputs of different length"); } Result::Ok(a.chars().zip(b.chars()).filter(|&(a, b)| a != b).count()) }
Version data entries
143 entries across 143 versions & 1 rubygems