1. Minimum Health Alex and Charlle are playing an online video game. Initially, there are
m
players in the first level, and there are next
n
levels. Each level introduces a new player (along with the players from the previous level). Each player has some strength which determines the difficulty of beating this player. To pass any level, select any available players and beat them. Alex has completed the game and beaten the rank
th strongest player at every level. Now it's Charlie's turn to play. Whenever a player is beaten, Charlie's health decreases by the amount of strength of that player. So the initial health of Charlie must be greater than or equal to the sum of the strengths of players that are beaten throughout the game. Charlie does not want to lose to Alex, so Charlie decided to also beat the rank
th strongest player at each level. What is the minimum initial health that Charlie needs to start with in order to do this? Example initlal, players
=[1,2]
, new_players
=[3,4]
, rank
=2
Charlie needs to beat the
2 nd strongest player at each level. For the first level, players have strengths 1 and 2 , so Charlie needs to beat the player with Charlie needs to beat the
2 nd strongest player at each level. For the first level, players have strengths 1 and 2, so Charlie needs to beat the player with strength
1.
For the second level, strengths are1, 2, and 3, so Charlie defeats strength