Data Structures & AlgorithmsVery hardCodeforces Div2 B-D · ICPC regional
How many index pairs i < j in [2, 3, 4, 5, 8, 9] have an odd sum?
- A. 9
- B. 15
- C. 6
- D. 3
Correct answer: A. 9
An odd sum needs one even (2, 4, 8) and one odd (3, 5, 9) element: 3 × 3 = 9 pairs. 15 counts all pairs, 6 counts the even-sum pairs, and 3 is the size of one group.
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 integers from 1 to 999 inclusive have all decimal digits distinct?
- Using coins of value 5, 2 and 1, what is the minimum number of coins that make the amount 11?
- How many positive integers x satisfy x^2 <= 500?
- What is the minimum number of elements of [1, 3, 2, 5, 4, 6] that must be changed (values may be set arbitrarily) so that the array…
- How many trailing zeros does 25! have?
- How many index pairs i < j of [1, 2, 3, 4, 5, 6] have a product strictly less than 20?