Data Structures & AlgorithmsHardCodeforces Div2 C · GATE CS
How many integers from 1 to 50 inclusive have a digit sum that is divisible by 5?
- A. 11
- B. 6
- C. 4
- D. 10
Correct answer: D. 10
Digit sums up to 50 are at most 13, so only sums 5 and 10 count: 5, 14, 23, 32, 41, 50 and 19, 28, 37, 46 = 10. Starting the range at 0 (digit sum 0) gives 11, counting only sum 5 gives 6 and only sum 10 gives 4.
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 minimum value of a[i] XOR a[j] over index pairs i < j in [15, 2, 19, 6, 11, 9]?
- How many integers from 1 to 40 inclusive have exactly as many 0-bits as 1-bits in their binary representation (without leading zeros)?
- Four jobs given as (deadline, processing time) are (2, 3), (4, 2), (5, 6), (7, 4) and run one after another from time 0. Order them by…
- What is the length of the longest substring of "pwwkewbcab" with no repeated characters?
- How many integers from 1 to 200 inclusive are divisible by 4 or by 6 but not by 12?
- A pancake flip reverses a prefix of length at least 2. What is the minimum number of prefix flips needed to sort [3, 1, 2] into increasing…