Amazon Interview Question

All question needed good amount of logical thinking.