Https://leetcode.com/problems/merge-intervals/


what is wrong in this code

Hey @nmaurya760 I understood the problem statement of leetcode. But can’t understand your approach. Can you give me an idea of your approach? Also have you submitted this problem on leetcode or not? If yes then send me the submitted code :slight_smile:

We have to make a pair of prime and composite so i am using p and c
Eg 5 11
No. Of primes = 3, no. Of composite=4
So ans= 3C1 * 4C1

But the problem of have attached says that Given a collection of intervals, merge all overlapping intervals.

Sorry…this is the question

Okay , give me sometime . I’ll debug it and let you know. Till then you can do your next question :blush:

hey @nmaurya760 there were few mistakes in your sieve function, like in for loop computation. i have edited your code and here it is https://ide.codingblocks.com/s/354648, have a look at it . Hope this would help :smile:

All test cases are not passing

Must be few side cases, like what if 1 & 2
What if n & n
You have to check for the side cases also.

For testcase
S=0
e=1
Expected Output is -12
But how the ans is -12 for this case

It’s a false test case, 1 & 0 are not prime
Answer should have been 0 2

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.