Consider the following code:
public long foo(long x) {
if(x == 1 || x == 3)
return x;
else
return x * foo(x-1);
}
Assuming no possibility of integer overflow, what will be returned by the following call to foo? foo(foo(3)+foo(4));
(15!)/(2!)3!+4!(7!)!(3!+4!)!15This function computes factorial, except that it leaves out 2 from the series of multiplications.
So, foo(3)+foo(4) = 15.