I’m solving LeetCode #172: Given an integer n, return the number of trailing zeroes in n! Constraints: 0 <= n <= 104 My code finds the answer of n! first and then counts the number of trailing zeroes. However, running the code throws a stack overflow exception, and I can’t for the life of me figure out why. This is
Tag: factorial
Java Factorial loop
The problem is that the factorial value is updating in a while loop I think that is the problem why. Here is the code Okay, so here is the problem when the first input is 5 The factorial of 5 is: 120 But on the second input it goes like this when I tried to input like for example 4