about | help | code help+videos | done | prefs |
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) |
Progress graphs:
Your progress graph for this problem
Random user progress graph for this problem
Random Epic Progress Graph
Difficulty: 260
Copyright Nick Parlante 2017 - privacy