Amazon Interview Question

A LC Easy with 2 follow ups 2 BQ