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

 

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

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)

public boolean[] test2024_02_08_SLHL_factorOf(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: 280

Copyright Nick Parlante 2017 - privacy