Data Structures & AlgorithmsHardGATE CS · ICPC regional
How many trailing zeros does 100! have when written in base 6?
- A. 97
- B. 16
- C. 48
- D. 33
Correct answer: C. 48
Each base-6 trailing zero needs one 2 and one 3, so the count is min(v₂, v₃). v₃(100!) = 33 + 11 + 3 + 1 = 48, while v₂ = 97. Taking v₂ gives 97, only ⌊100/3⌋ gives 33, and ⌊100/6⌋ = 16 counts multiples of 6.
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
- What is the sum of all distinct prime factors of the product 12 35 49 (sum each prime once, however many times it divides the product)?
- What is the lexicographically smallest string obtainable by deleting exactly one character from cbabc?
- How many length-3 windows of the string aabxaaba have at most one position that differs from the pattern aab?
- How many binary strings of length 6 contain no two consecutive 1s?
- How many integers x with 1 <= x <= 500 are divisible by exactly one of 6 and 8?
- What is the value of the expression (1^2) + (2^2) + ... + (50^2) modulo 7?