Having a little trouble trying calculate the number of trailing zeros in a factorial of a given number. This is one of the challenges from Codewars- can\'t get mine to pass.
Here's a solution that is easier to read:
def zeros(num) char_array = num.to_s.split('') count = 0 while char_array.pop == "0" count += 1 end count end
Let me know what you think and feel free to edit if you see an improvement!