Amazon Interview Question

Math question