Add the other implementations of the snuggle function in comments

This commit is contained in:
Nathan Stocks
2021-10-04 21:31:54 -06:00
parent 5113e8c8eb
commit 4c2975c19b

View File

@@ -9,6 +9,22 @@ pub fn snuggle(bunnies: u128) -> u128 {
bunnies << 3 bunnies << 3
} }
// The typical, multiplication approach
//
// pub fn snuggle(bunnies: u128) -> u128 {
// bunnies * 8
// }
// The loop approach
//
// pub fn snuggle(bunnies: u128) -> u128 {
// let mut result = 0;
// for _ in 0..8 {
// result += bunnies
// }
// result
// }
#[cfg(test)] #[cfg(test)]
mod test { mod test {
use std::num::ParseIntError; use std::num::ParseIntError;