20240731 Finished
This commit is contained in:
parent
bd6382ab87
commit
dc662fe156
|
@ -189,4 +189,5 @@ mod p191_number_of_1_bits;
|
||||||
mod p136_single_number;
|
mod p136_single_number;
|
||||||
mod p137_single_number_ii;
|
mod p137_single_number_ii;
|
||||||
mod p201_bitwise_and_of_numbers_range;
|
mod p201_bitwise_and_of_numbers_range;
|
||||||
mod p66_plus_one;
|
mod p66_plus_one;
|
||||||
|
mod p172_factorial_trailing_zeroes;
|
32
src/problem/p172_factorial_trailing_zeroes.rs
Normal file
32
src/problem/p172_factorial_trailing_zeroes.rs
Normal file
|
@ -0,0 +1,32 @@
|
||||||
|
/**
|
||||||
|
* [172] Factorial Trailing Zeroes
|
||||||
|
*/
|
||||||
|
pub struct Solution {}
|
||||||
|
|
||||||
|
|
||||||
|
// submission codes start here
|
||||||
|
|
||||||
|
impl Solution {
|
||||||
|
pub fn trailing_zeroes(n: i32) -> i32 {
|
||||||
|
let mut n = n;
|
||||||
|
let mut result = 0;
|
||||||
|
|
||||||
|
while n > 0 {
|
||||||
|
n /= 5;
|
||||||
|
result += n;
|
||||||
|
}
|
||||||
|
|
||||||
|
result
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// submission codes end
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
mod tests {
|
||||||
|
use super::*;
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_172() {
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user