Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int CountSteps(int n)
- {
- if (n <= 0)
- {
- return 0;
- }
- int ret = 0;
- while (n != 1)
- {
- ret += 1 + (n & 1);
- n >>= 1;
- }
- return ret + 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement