Amazon Interview Question

It was an online coding assessment.