Marks :10
: 0 | : 1
You are given $$$n$$$ intervals of the form $$$(l_i,r_i)$$$ which contains all integers from $$$l_i$$$ to $$$r_i$$$. You need to output the size of the smallest set having atleast $$$2$$$ integers. Output $$$-1$$$ if no such interval exists.
The first line contains a single integer $$$n(1 \leq n \leq 10^5)$$$. The next line contains the $$$n$$$ integers $$$l_1,l_2,...,l_n$$$. The next line contains the $$$n$$$ integers $$$r_1,r_2,...,r_n(0 \leq l_i \leq r_i \leq 10^9)$$$.
Output a single integer - the answer to the problem.
3 1 2 3 3 4 5
3
You need to login to view your submissions.
You need to login to view all submissions.
Result : Executed
Feel something is wrong with the test cases?
Result : Accepted
Test Cases :
But to Run or Submit the Problem, you need to Log In.
Continue to Log InYour challenge has been submitted successfully.
You will get a response soon via WhatsApp or Email.
Do let us know your issue.