about | help | code help+videos | done | prefs |
Write a method that returns how many factors of 2 a number has. For example, 40 has 3 factors of 2 because 40 can be factored into the primes 2*2*2*5. Some numbers do not have factors of 2, such as 13, 17, and 21. Other number has nothing but factors of 2, such as 64. In each case, return how many factors of 2 'num' has. As preconditions, you may assume that 'num' is non-negative. Look at the test data for examples. test2025_05_22_APP1SL_factorsOfTwo(834) → 1 test2025_05_22_APP1SL_factorsOfTwo(482) → 1 test2025_05_22_APP1SL_factorsOfTwo(262144) → 18 ...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: 250
Copyright Nick Parlante 2017 - privacy