ageScorePair
.ageScorePair
by age, and then by score in ascending order.dfs
that takes the current index and the index of the last player added to the team. This function returns the maximum score possible from this point onwards.dfs
, if the current player can be added without conflict (i.e., their score is higher than the last added player's score), explore both possibilities: adding or not adding the player to the team.dfs
is when all players have been considered, in which case the function returns 0.dfs
starting with the first player and no previous player is the result.