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

 

nCombinationsAddingTo


Define a function that when passed an integer array (say, data) an integer (say, target), and the starting index (say, idx), returns the number of combinations in which zero or more items of the array starting at idx can be added together to construct the target.


nCombinationsAddingTo([10, 70, 20, 90], 90, 0) → 2
nCombinationsAddingTo([1, 2, 3, 4, 5, 6], 10, 0) → 5
nCombinationsAddingTo([], 0, 0) → 1

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

int nCombinationsAddingTo(int[] data, int target, int idx) { }

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: 5 Post-solution available

Copyright Nick Parlante 2017 - privacy