6 kyu
Button Quest: Path to N
Description:
Your friend has discovered an old machine that performs simple mathematical operations. The machine has only two buttons:
+1 — adds one to the current number.
x2 — multiplies the current number by two.
The machine starts with the number 1. Now, your friend wants to know how many different ways it is possible to obtain a given number n using these buttons. Help them write a program that calculates this number.
Constraint: 1 ≤ n ≤ 10**6
Similar Kata:
Stats:
Created | Jan 1, 2025 |
Published | Jan 1, 2025 |
Warriors Trained | 137 |
Total Skips | 2 |
Total Code Submissions | 311 |
Total Times Completed | 55 |
Python Completions | 55 |
Total Stars | 3 |
% of votes with a positive feedback rating | 87% of 15 |
Total "Very Satisfied" Votes | 11 |
Total "Somewhat Satisfied" Votes | 4 |
Total "Not Satisfied" Votes | 0 |
Total Rank Assessments | 11 |
Average Assessed Rank | 6 kyu |
Highest Assessed Rank | 6 kyu |
Lowest Assessed Rank | 7 kyu |