You are a Pokémon trainer. Each Pokémon has its own power, described by a positive integer value. As you travel, you watch Pokémon and you catch each of them. After each catch, you have to display maximum and minimum powers of Pokémon caught so far. You must have linear time complexity. So sorting won’t help here. Try having minimum extra space complexity.
Suppose you catch Pokémon of powers 3 8 9 7. Then the output should be
Input : The single line describing powers of N Pokémon caught. Output : N lines stating minimum power so far and maximum power so far separated by single space
Code : Python code to implement Pokemon training game
3 3 3 8 3 9 3 9
Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.
To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course.