Data Structures & AlgorithmsModerateCAT · TCS NQT
Problem: How many 3-digit numbers (100–999) have digits that form a strictly increasing sequence when read left to right?
- A. 84
- B. 120
- C. 165
- D. 720
Correct answer: A. 84
The leading digit is the smallest, so 0 is never usable: C(9,3) = 84. C(10,3) = 120 wrongly allows 0, non-decreasing triples give 165, and 10 · 9 · 8 = 720 counts ordered choices.
More Coding Interview Problems questions
- Problem: In a list of the first 30 positive integers, how many numbers are multiples of 2 or 3 but not of 6?
- Problem: For the array [6, 1, 8, 3, 7], find the minimum number of adjacent swaps needed to sort it in increasing order (adjacent swaps…
- Problem: Starting at the number 2, repeatedly apply f(x) = x² + 1 modulo 11. What is the value after 5 applications?
- Problem: The array [2, 3, 4, 5, 6, 7, 8] is examined for the number of subsets whose sum is a perfect square (the empty subset has sum 0…
- Problem: In the string "xyxyxy", how many substrings of length 4 are palindromes?
- Problem: A sequence of 10 operations applies to an initial value of 0: operation i (1 ≤ i ≤ 10) adds i if i is odd and multiplies the…