Balanced Athlete Team Splitting
You are given a team of athletes, each with a specific strength, numbered from 1 to n. Your goal is to divide these athletes into two teams, ensuring that each team contains at least one athlete and that each athlete belongs to only one team.
The objective is to split the athletes in such a way that the difference between the strongest athlete in the first team and the weakest athlete in the second team is as small as possible. In other words, you want to minimize the absolute difference between the maximum strength in the first team (max(A)) and the minimum strength in the second team (min(B)).
Your task is to find and print the minimum value of |max(A) - min(B)|.
Example 1
Input:
Output:
Explanation:
main.cpp
Pergunte à IA
Pergunte à IA
Pergunte o que quiser ou experimente uma das perguntas sugeridas para iniciar nosso bate-papo