-
July 8th, 2015, 01:52 AM
#1
Question from Exam Array and Recursive
Hello!
I've trying to solve this question from exam, i'll try to translate it:
s - array of numbers, integer greater than 0.
n - int number.
n is a sum of numbers in 's' array, for example:
s = { 4 , 5 }
n = 13
because 13 can be expressed as 4+4+5, 6 cant be sum of 's' array.
0 can be sum of this 's' array.
Write boolean, recursive method which receives an array 's' of integer numbers and return true is sum can be expressed and false otherwise.
You may not use any loops in your methods, you may use overloading, and private methods - no loops.
This method will print the solution.
the method signature is:
public static boolean isSumOf(int[] s, int n)
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|