id/email
password
forgot password | create account
about | help | code help+videos | done | prefs
CodingBat code practice

 

andersoniii.edwin@cusd80.com > CountOfAllFactors
prev  |  next  |  chance

Let's find how many of each of the factors for any integer. You do remember how to factor... right well, we will find all of the factors of a number. We will place the number of times that factor is found in the given number into an array of integers where the subscript is the factor. Example 24 [0,1,3,1,1,0,1,0,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,1]


CountOfAllFactors(24) → [0, 1, 3, 1, 1, 0, 1, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1]
CountOfAllFactors(1) → [0, 1]
CountOfAllFactors(2) → [0, 1, 1]

...Save, Compile, Run (ctrl-enter)

public int[] CountOfAllFactors(int num){ }

Editor font size %:
Shorter output


Forget It! -- delete my code for this problem

Progress graphs:
 Your progress graph for this problem
 Random user progress graph for this problem
 Random Epic Progress Graph

Java Help

Misc Code Practice

Difficulty: 102 Post-solution available

Copyright Nick Parlante 2017 - privacy