Amazon interview question

Find bugs in the given code. Fill the truck problem.