Thank you poker2008,

I see now, too bad :(.

I've ordered first the tasks and now the code passes test set.

But I don't know how to optimize the solution for Big-O N-LOGN.

In the Analysis they say:
The running time of this solution is O(*N*2), which is fast enough to solve
this test set. To optimize the solution to O(*N* log *N*) time, we can
efficiently check whether an activity can be assigned to Jamie or Cameron
by keeping track of the end time of the last activity assigned to each
partner and comparing this to the start time of the new activity. In this
case, only O(*N*) extra time is needed after sorting the activities by
their start time.

I think that running time is not possible, Do you have some
example with NlogN?

Here my solution <http://ParentingPartneringReturns/Solution.java>

Nuria


On Mon, Apr 13, 2020 at 10:02 PM porker2008 <zhangxion...@gmail.com> wrote:

> Your printing order is correct.
> My point is for some specific input, there is a solution but your program
> will output *IMPOSSIBLE*
>
> e.g.
>
> Input:
> *1*
> *4*
> *0 1*
> *5 6*
> *0 2*
> *1 6*
>
> Expected output:
> *Case #1: CJJC* (or *JCCJ*)
>
> But your program will return *IMPOSSIBLE*
>
> --
> 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/e34b0bcf-cd2f-4c89-908a-0a9e53c84d2a%40googlegroups.com
> <https://groups.google.com/d/msgid/google-code/e34b0bcf-cd2f-4c89-908a-0a9e53c84d2a%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>


-- 



*Nuria Ruiz Sánchez*

Desarrollos y Aplicaciones
(+34) 686 871 682

nuria.r...@gmail.com <nuria.r...@marsans.es>

Palma de Mallorca

-- 
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/CANHPObRV-OdU7_PTmHhBCUYu1OTgN0WjGOWMYMwCYw8V%2BkBNCQ%40mail.gmail.com.

Reply via email to