12 May 2017

Least Factorial

My solution:
int leastFactorial(int n) 
{
    var i = 1;
    while (Factorial(i) < n)
        i++;

    return Factorial(i);
}

int Factorial(int p0)
{
    if (p0 > 1)
        return Factorial(p0 - 1) * p0;

    return 1;
}

Previous Next