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

 

gaurav1780@gmail.com 07_recursion > combinations_adding_to
prev  |  next  |  chance

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.


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

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

def combinations_adding_to(data, target, 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

Python Help

Difficulty: 5 Post-solution available

Copyright Nick Parlante 2017 - privacy