Algorithm · Karat · Hard
You are handed a collection of head-to-head results between cards. Each result identifies one card as the winner and the other as the loser of that matchup. A card is considered to beat another card either directly (it won their matchup) or indirectly (it beat some card that, in turn, beats the other card, through any chain of results). Find the card that beats the largest number of distinct other cards when both direct and indirect victories are counted, and return it. If…