logo CodeStepByStep logo

waysToAverage

Language/Type: Java recursion backtracking
Related Links:

Write a method named waysToAverage that accepts a list of integers and a target value k as parameters and returns the number of subsets of the list that have an average element value of exactly k. For example, if the list stores [7, 9, 8, 9] and k is 8, there are four subsets of the list that have an average element value of 8: [8], [7, 9], [7, 9], [7, 8, 9], and [7, 8, 9], so you should return 5.

Method: Write a Java method as described, not a complete program or class.

You must log in before you can solve this problem.

Log In

Need help?

Stuck on an exercise? Contact your TA or instructor.

If something seems wrong with our site, please

Is there a problem? Contact us.