Same Algorithm applied but not able to get Correct output
The question is BusyMan just to make sure we are on the same page because i don’t know which circle are you talking about
@unforgettable_pawan
your map is not sorted correctly.
for example->
1
4
1 7
5 8
7 8
1 8
the first activity u r code is giving is having ending time 8. but it should be 7.
check this issue. i cannot help u in java much.sorry for that.
I have already posted the code link in the first comment you can refer the link. If you need it again here it is -> https://ide.codingblocks.com/s/228227
Thanks for the help i got the previous error resolved and my code is giving correct output for the sample test case on SPOJ but when i submit my solution on SPOJ it’s giving me TLE. Can you help me with it? The updated code link is -> https://ide.codingblocks.com/s/228264
use array in place of list.
because array has faster access time compared to list.
but how to store values in pair in a array?
refer this example-> https://www.geeksforgeeks.org/sort-an-array-of-pairs-using-java-pair-and-comparator/
I tried doing it with Array but still getting TLE. Here’s the link to code with array -> https://ide.codingblocks.com/s/228628
this is the most efficient algorithm,
time limit might be two strict for java
almost all java code are getting tle.

so there’s nothing that we can do. Thanks for all the help.
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.