Data Structures & AlgorithmsHardGATE CS · TCS NQT
How many trailing zeros does 50! (50 factorial) have in decimal?
- A. 10
- B. 12
- C. 47
- D. 2
Correct answer: B. 12
Trailing zeros = exponent of 5 in 50! = ⌊50/5⌋ + ⌊50/25⌋ = 10 + 2 = 12. Using only ⌊n/5⌋ gives 10 (25 and 50 each hold two 5s), 2 is only the second term, and 47 is the exponent of 2, which is never the limit.
Practise more Arrays, Strings, Linked Lists, Stacks, Queues and Hashing questionsArrays, Strings, Linked Lists, Stacks, Queues and Hashing: notes and key points
More Arrays, Strings, Linked Lists, Stacks, Queues and Hashing questions
- How many palindromic substrings of length at least 3 does "racecarxyzzyx" contain (counted by position)?
- For each value n in [10, 27, 50], count the positive integers x with x^3 <= n, then add the three counts. What is the total?
- How many adjacent positions in [3, 9, 4, 7, 1] have a[i] > a[i+1]?
- What is the minimum number of characters that must be inserted at the front of "abcdc" to make it a palindrome?
- Remove exactly one element from [5, -4, 3, -7, 2], then take the maximum product of two distinct remaining elements. What is that maximum…
- How many starting positions in "abcbabcab" match the pattern "abc" with exactly one mismatched character?