for input
4
2 5 8 10
6 4 1 2
why valid inputs are (8,1) and (10,2)
but here 2,6 ; 5,4 ; 8,1 and 10,2 all endpoints are instersecting.
Please, explain these input test case as well
1 2 3 4 5 6
3 4 5 6 1 2
for input
4
2 5 8 10
6 4 1 2
why valid inputs are (8,1) and (10,2)
but here 2,6 ; 5,4 ; 8,1 and 10,2 all endpoints are instersecting.
Please, explain these input test case as well
1 2 3 4 5 6
3 4 5 6 1 2
hey Vikash!
see these statements

Test cases are failing could you please suggest what test cases are not covered by my code . https://ide.codingblocks.com/s/251591
actually we have to sort it (as we might miss some even taking both LIS and LDS) but sorting should be pairwise(so that relative order is not destroyed, may this was what you said earlier!)!
then just find LIS!
I have updated the code and when and even after shuffling the given inputs i am getting correct output. But while submission its failing. I have updated my code in IDE.
your bridges can intersect at endpoints!
so dp condition should be >=, also don’t use map as it omits duplicate endpoints
I have modified the code as you have suggested but still two of the test cases are failing. Could you please suggest what i am missing…
You may refer to my code(implemented same logic!)
What is different in my code . In the given code you are taking LDS and its working. I am getting what is different in my code. Even i tried executing the code after removing the LDS still same two test cases were failing
i have updated code in in the given coding block ide as well. Not getting what i am missing. Could you please provide me some test cases for which my code is not proper.
I have sorted the array pairwise, so LDS is not required.
You may download the test cases from editorial/solution section and see where your code fails.
I have also sorted array pairwise . Could you please suggest what i am missing ?
your sorting is bit incorrect,
first give priority to smaller array[i].first, if in case when array[i].first==array[j].first, give priority to smaller array[].second, means that element with smaller second element should come first.
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.