Capital One Interview Question

coding question - tennis game.