Third Bridge Interview Question

quite straightforward