Data Structures & AlgorithmsVery hardICPC regional · Amazon SDE OA
What is the smallest positive integer n such that n! ends in exactly 10 trailing zeros?
- A. 46
- B. 50
- C. 45
- D. 40
Correct answer: C. 45
Trailing zeros of n! equal the sum of floor(n/5^k). The first n reaching exactly 10 is 45, since 45 gives 9 + 1 = 10 and 40 gives only 9 zeros.
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
- Items [1, 1, 1, 1, 2, 2, 3] must be placed into stacks of capacity 3 such that each stack holds only identical items. What is the minimum…
- How many index pairs i < j in [0, 1, 2, 3, 4] satisfy a[i] + a[j] = a[i] a[j]?
- Repeatedly remove adjacent equal characters from "abbaca" using a stack. How many characters are removed in total?
- How many integers n from 1 to 99 inclusive have both n and n + 1 squarefree (not divisible by any square greater than 1)?
- Choose the fewest intervals of length 3 (covering integer points s, s+1, s+2 for a start s from 1 to 8) so that every integer point from 1…
- How many integers x with 1 ≤ x ≤ 2024 have NO two equal adjacent digits in their decimal representation?