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

 

jebbert@volusia.k12.fl.us > test2021_09_16_HL_factors
prev  |  next  |  chance

A proper factor is any factor of a number EXCEPT itself. So 1, 2, 3, and 6 are all proper factors of 12, but 12 is NOT a proper factor of 12 (even though it is a FACTOR of 12 because 12*1=12). Write a method that looks for proper factors in an array. Return a boolean array that indicates if a proper factor was found before the position of each number. For example, in the array {4,12,5,30,21,24} There is no proper factor of 4 before the position of the 4 so the first element in the boolean array would be 'false'. For the 12, there is a proper factor (4) before the position of the 12, so in that same position in the boolean array would be a 'true'. The entire boolean array that gets returned would be {false, true, false, true, false, true}. Look at the test data for other examples.


test2021_09_16_HL_factors([50]) → [false]
test2021_09_16_HL_factors([12]) → [false]
test2021_09_16_HL_factors([18, 18]) → [false, false]

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

public boolean[] test2021_09_16_HL_factors(int[] nums) { }

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: 260

Copyright Nick Parlante 2017 - privacy