Question: Write a recursive method to determine if an array of integers contains an integer that is the sum of two integers appearing earlier in the
Write a recursive method to determine if an array of integers contains an integer that is the sum of two integers appearing earlier in the array; that is, for some i, A[i] = A[j]+ A[k] for some j,k < i. Write a program that takes as input two lines: the rst line contains a single integer between 1 and 10, and the next line contains that many integers, separated by spaces. The output is true if one of the integers is the sum of two previous ones, and false otherwise. Call your program SumOfPrevious. (JAVA)
For example, if the input is
7
5 2 4 1 6 8 1
then the correct output is true
If the input is
4
7 6 5 4
then the correct output is false
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
