You are trying to do greedy for picking yogurt everyday

Your algorithm:
1. Sort all yogurt by their expiry day.
2. Each day, until I am full, I check the next yogurt
2.1 If the yogurt is not expired, I eat them
2.2 If the yogurt is expired, I throw it away and end this day.

The mistakes happen at 2.2
Instead of ending this day, you should keep checking the next yogurt until
you are full.

Akshay Mittal <[email protected]>于2018年9月18日周二 上午7:49写道:

> just make sure you add comments and output statements saying what your
> trying to do.
> which might help others help you.
>
> --
> 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 [email protected].
> To post to this group, send email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/google-code/222a4805-b60f-47cd-ad7e-227f2fb471ca%40googlegroups.com
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-code/CAGDEU-%2BuKF0Ysn7yZcrXQ2b5bJ1Qv79RgNDbxvo58wdqg3d_jA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to