Minion Chef and Bananas (MINEAT) .....Please tell me what's wrong with my solution

This is the question:

This is my solution -

My solution gives correct answer for sample test cases. I know this solution will not get me through Subtask2 but I think it should have cleared Subtask1. Please help.

“Chef would like to make sure that she can finish eating all bananas by that time”
What you are doing is checking if time == hour. if(time<=hour) then also it will do, because she just wants to finish it before her mother comes.

thanks a lot