Ad
  • Default User Avatar

    Most likely it indicates that your code runs out of time, as the input n is in range [0, 10e6] and (10e6)! has more than 50e7 digits. Both computing n! (multiplying for big integer is expensive too) and extracting digits from n! by dividing 10 forms performance bottleneck.