Data Structures & AlgorithmsHardGATE CS · Codeforces Div2 B
How many unordered pairs {a, b} with 1 <= a < b <= 12 have a + b divisible by 4?
- A. 16
- B. 15
- C. 17
- D. 19
Correct answer: B. 15
Group the numbers 1 to 12 by residue mod 4 (three of each residue) and count compatible residue pairs: 0 with 0, and 1 with 3, 2 with 2.
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 product of all positive divisors of 36?
- A robot starts at (0, 0) and performs the moves L, U, R, R, D, D, L, U, U, R, R. Moves L/R change x, U/D change y. What is the Manhattan…
- How many integers x in [1, 1000] have digit sum equal to 9 and are divisible by 9?
- There are 7 people in a circle numbered 1 to 7. Starting at person 1 and counting 1, 2, 3, ..., every 3rd person is removed until one…
- How many contiguous subarrays [i..j] of [2, 5, 3, 5, 1] have a[i] equal to the maximum of that subarray (ties allowed)?
- Three jobs given as (processing time, weight) are (3, 2), (1, 4), (2, 1). They run one at a time from time 0. What is the minimum possible…