beyondgrader.com Logo
DemoBrowseAboutTeamLogin

Recursive Factorial

Geoffrey Challen // 2020.11.0

Implement a method factorial that accepts a single Long and returns its factorial as a Long. You can reject negative arguments and ones greater than 20 by throwing an IllegalArgumentException.

You should submit a recursive solution. The factorial of 0 is 1, and this represents the base case. The factorial of n is n * the factorial of n - 1, and this represents the recursive step.