Data Structures & AlgorithmsVery hardICPC regional · Amazon SDE OA
What is the number of trailing zeros in the decimal representation of the product 10 * 25 * 4 * 15 * 50?
- A. 5
- B. 3
- C. 4
- D. 2
Correct answer: C. 4
Trailing zeros equal min(v2, v5) of the product. Counting factors of 2 and 5 separately per element gives the same answer as multiplying out the product.
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 distinct sums appear over all non-empty contiguous subarrays of [2, 1, 3, 1]?
- Ropes of lengths 4, 3, 2 and 6 must be joined pairwise into one rope; joining costs the sum of the two lengths and you may join any two…
- How many distinct palindromic strings of length 3 occur as subsequences of "abcba"?
- How many unordered pairs of words in ["listen", "silent", "enlist", "google", "gogole", "cat", "act"] are anagrams of each other?
- Replace every element simultaneously by (a[i] + a[i-1]) mod 10, indices cyclic, on [1, 2, 3, 4]. What is the resulting array?
- Activities (start, finish) are [(1, 4), (3, 5), (0, 6), (5, 7), (3, 9), (5, 9), (6, 10), (8, 11), (8, 12), (2, 14), (12, 16)]. Two…