about | help | code help+videos | done | prefs |
How many times can you double a number until the result reaches or exceeds 1000? For example if you start with 3 and keep doubling, you will get 6, 12, 24, 48, 96, 192, 384, 768, 1536. It took 9 steps to reach or exceed 1000. Write a method that takes a starting value and returns the number of doubling steps it takes to reach or exceed 1000. The starting number will always be positive and less than 1000. The starting number will be greater than zero. stepsTo1000(3) → 9 stepsTo1000(1) → 10 stepsTo1000(500) → 1 ...Save, Compile, Run (ctrl-enter) |
Progress graphs:
Your progress graph for this problem
Random user progress graph for this problem
Random Epic Progress Graph
Difficulty: 200
Copyright Nick Parlante 2017 - privacy