Amazon Interview Question

logical java questions