Amazon Interview Question

Solve XX in code on whiteboard