Datasets:
Tasks:
Text Generation
Modalities:
Text
Formats:
json
Languages:
English
Size:
< 1K
ArXiv:
Tags:
competitive-programming
code-generation
specification-generation
proof-generation
verification
rust
License:
File size: 319 Bytes
4c0e24e | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | impl Solution {
pub fn number_of_steps(num: i32) -> i32 {
let mut n = num;
let mut steps = 0i32;
while n > 0 {
if n % 2 == 0 {
n = n / 2;
} else {
n = n - 1;
}
steps = steps + 1;
}
steps
}
}
|