Data Structures & AlgorithmsVery hardGATE CS · ICPC regional
How many pairs (a, b) with 1 <= a <= b <= 12 satisfy lcm(a, b) > 36?
- A. 21
- B. 22
- C. 20
- D. 24
Correct answer: C. 20
Each pair is counted once with a <= b, and a pair such as (a, a) has lcm a, which never exceeds 36 here. Checking each pair directly is feasible at this size.
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
- Treat [4, -1, 5, -6, 3] as circular. Over all contiguous circular windows of length 1 to 5, what is the maximum window sum?
- How many integers from 1 to 1000 inclusive have a decimal digit sum equal to 10?
- What is the length of the longest contiguous subarray of [2, 2, 1, 3, 1, 1, 2] whose sum is divisible by 4?
- How many arithmetic triples (x, x+d, x+2d) with d >= 1 consist entirely of values from [1, 2, 3, 5, 7, 9]?
- Five jobs given as (processing time, deadline) are (4,4), (2,2), (3,3), (1,1), (6,7). You run them in some order, and a job is late if it…
- How many index pairs i < j in [4, 1, 5, 3, 2, 6] satisfy 0 < a[i] - a[j] <= 2?