about | help | code help+videos | done | prefs |
Write a method that returns an array of boolean based on the positive numbers in 'nums'. The boolean array will have one less element than 'nums' because the boolean array is based on comparisons between adjacent pairs of numbers in 'nums'. For each adjacent pair of numbers in 'nums' the boolean array will need to contain 'true' if the first number is a factor of the second number, but will contain 'false' if the first number is NOT a factor of the second number. For the purpose of this problem, consider 1 to be a factor of every number. As preconditions, you may assume that all the numbers in 'nums' are positive and that there are at least two numbers in 'nums'. test2024_02_08_SLHL_factorOf([2, 4, 8, 16, 32, 64, 128, 256, 512, 65536]) → [true, true, true, true, true, true, true, true, true] test2024_02_08_SLHL_factorOf([2, 64, 640, 1640]) → [true, true, false] test2024_02_08_SLHL_factorOf([4, 20, 100, 500, 800, 1600]) → [true, true, true, false, true] ...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: 280
Copyright Nick Parlante 2017 - privacy