Oh didn't notice that you override the equal() to for checking overlap. As Matt pointed out, this is not efficient because you have to run through the entire list to determine whether the new activity can be assigned to C or J, and it leads to O(N) to process each new activity and hence O(N^2) for overall complexity
To improve the running time, you just need to compare the new activity to the last activity that was assigned to C or J. This is because those tasks will have the latest end time of all tasks that were assigned to C or J already. -- You received this message because you are subscribed to the Google Groups "Google Code Jam" group. To unsubscribe from this group and stop receiving emails from it, send an email to google-code+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/google-code/8f3fc265-eac3-45a9-a79f-aeb65e5564f3%40googlegroups.com.