Add the other implementations of the snuggle function in comments
This commit is contained in:
@@ -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;
|
||||||
|
|||||||
Reference in New Issue
Block a user