Data Structures & AlgorithmsHardCodeforces Div2 C · GATE CS
Among intervals [1,6], [4,9], [5,5], [2,8], [5,7], [3,6] that contain the point 5, what is the largest number that are pairwise disjoint (closed intervals sharing a point are not disjoint)?
- A. 2
- B. 0
- C. 4
- D. 1
Correct answer: D. 1
Every interval here contains 5, so any two of them overlap at 5 and at most one can be chosen. The answer is therefore 1, and choosing more would violate disjointness.
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 index pairs i < j in [2, 3, 4, 5, 8, 9] have an odd sum?
- 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?