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

 

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

Write a method that determines if it is possible to reach the 'target' sum using any combination of the integers in the 'nums' array. In order to make your life simpler, I have included a 'location' parameter that will make it easier to do the recursion for this problem (yes, recursion is required this time!). The 'location' parameter will always start at 0. It indicates where in the array to start looking for numbers to include. So once you either use or don't use the first element in the array, you can use a new location of 1, saying that you no longer need to look at the numbers before index 1 because you have already either used or not used them. If this does not make sense, you are free to solve the problem some other way, as long as it is a recursive solution! So recursion is REQUIRED this time!


preEaglesJumpSumAdvanced2([5, 7, 12, 2, 3], 0, 19) → true
preEaglesJumpSumAdvanced2([4, 9, 1, 200], 0, 201) → true
preEaglesJumpSumAdvanced2([4, 9, 1, 200], 0, 16) → false

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

public boolean preEaglesJumpSumAdvanced2(int[] nums, int location, int target) { }

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