Amazon Interview Question

Basic calculation