Given an integer n, write a function that returns count of trailing zeroes in n!. Examples: Input: n = 5 Output: 1 Factorial of 5 is 20 which has one trailing 0. Input: n = 20 Output: 4 Factorial of 20 is 2432902008176640000 which has 4 trailing zeroes. Input: n = 100 Output: 24
23 times
ReplyDelete@Dave 22 times a day if you only count the minute and hour hands overlapping.
ReplyDeleteif you have any explanation for your answer please do comment.
should be 24 times of the minute n hour hands !
ReplyDelete@anonymous can you please explain..
ReplyDeleteIf you start from 1 to 12 hours a day it overlaps 12 times and similarly for another 12 hours which makes it 24
ReplyDelete@ Overlapping will occur when Lm = Lh +N, which means every N*(12/11) hours (for N = 0,1,2,3...). In other words, it will happen approximately every 1hr5mins27secs, starting at 00:00. In 24hours, this occurs a total of 24/(12/11) = 22..
ReplyDeletedo give your explanations..
The hour and the minutes clock coincide every 1 hr 5 min as u said but i think it happens 24 times as shown below:
ReplyDeleteOO:00, 01:05, 02:10, 03:15, 04:20, 05:25, 06:30, 07:35, 08:40, 09:45, 10:50, 11:55, 12:00, 13:05, 14:10, 15:15, 16:20, 17:25, 18:30, 19:35, 20:40, 21:45, 22:50, 23:55..this adds up to 24 times..will you please explain which cases your algorithm leaves from above.
@above here are overlapping times :
ReplyDeleteam
12:00
1:05
2:11
3:16
4:22
5:27
6:33
7:38
8:44
9:49
10:55
pm
12:00
1:05
2:11
3:16
4:22
5:27
6:33
7:38
8:44
9:49
10:55