Data Structures & AlgorithmsHardTCS NQT · ICPC regional
Problem: What is the largest integer n such that n! has at most 3 trailing zeros in base 10?
- A. 19
- B. 15
- C. 14
- D. 24
Correct answer: A. 19
Zeros of n! jump to 4 at n = 20 (20 contributes a fifth 5), so 19 is the largest n with at most 3. 15 is the first n with 3 zeros, 14 the largest with at most 2, and 24 the largest with at most 4.
More Coding Interview Problems questions
- Problem: The matrix [[2,0],[0,3]] is raised to the power 4 (matrix power). What is the sum of all entries of the result?
- Problem: A word is "statistics". How many distinct letters appear at least twice in it?
- Problem: A sorted array [2, 3, 5, 7, 11, 13, 17, 19] is searched for 11 using binary search with mid = (lo + hi) // 2 over the inclusive…
- Problem: Consider the string "xyzzyzyx". How many distinct substrings of length 2 are there?
- Problem: The array [1, 4, 6, 3, 8, 2] is processed by a single pass that tracks the maximum so far. How many elements are records…
- Problem: A set of 10 people is divided into 5 pairs. How many distinct ways are there to form these pairs (unordered pairs, unordered…