Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Program for We have N numbers, we can have multiple ranges(M) defined. We need to find the number of distinct numbers that exist in multiple
Program for We have N numbers, we can have multiple ranges(M) defined. We need to find the number of distinct numbers that exist in multiple range, and the number selected should not be selected from any other range.
For Example:- Sample Testcase1:- N=5 M=3( Number of ranges) [1,4] , [2,5] , [3,4]
Output :- 1
Sample TestCase 2:-
N=5 M=3 [1,3] , [2,4] , [3,4]
Output:-3 (We can have 1,4,5 uniquely)
Sample TestCase 3:-
N=5 M=3 [1,4] , [2,4] , [3,4]
Output - 2( We can have 4 and 5)
Constraints 1<=N<=2*10^5 1<=M<=10^5 1<=L[i] <= 10^5 1<=R[i] <=10^5
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started