Skip to content

Files

Latest commit

31cf0e7 · Jul 22, 2021

History

History

leastFactorial

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
Jul 22, 2021
Jul 19, 2021

**Given an integer n, find the minimal k such that

k = m! (where m! = 1 * 2 * ... * m) for some integer m; k >= n. In other words, find the smallest factorial which is not less than n.**

Example

For:

n = 17

the output should be:

leastFactorial(n) = 24

17 < 24 = 4! = 1 * 2 * 3 * 4, while 3! = 1 * 2 * 3 = 6 < 17)

follow me on instagram