GlobalLogic Interview Question

A Logical question related to fruit vending machine.