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

 

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

Write a method that returns 'true' if it is possible to make the 'targetProd' by multiplying numbers selected from the 'nums' array. Return 'false' if it is not possible. For example, if 'nums' is {5,10,3,2} and 'targetProd' is 100, you would return 'true' because the product of 5, 10, and 2 is 200. However, with the same 'nums' array, if 'targetProd' is 17 you would return 'false' because no combination of numbers from 'nums' will multiply together to give you 17. Look at the test data for examples.


prodPossX2([2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59], 902) → true
prodPossX2([2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59], 3128) → false
prodPossX2([7, 10], 70) → true

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

public boolean prodPossX2(int[] nums, int targetProd) { }

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

Copyright Nick Parlante 2017 - privacy