Company: Epam_18oct
Difficulty: medium
Minimizing the Best Problem Description Recently Yash was taught about the best chances a team could have winning a football match. The chances totally depended on the sum of the number of goals a team can score. He was given a series of goals the team scored in its matches. He was then tasked to find the worst-case scenario for the team. The worst case scenario is when, a team no matter how it tries, ends up minimizing the sum of goals of its two matches. Can you help Yash in finding the minimum, possible chances? Input Format: The first number is an integer N, denoting the number of matches the team played. The subsequent N lines are the goals of the matches the team played. Output Format: The output is an integer, denoting the minimized maximum goal sum of the matches the team played. Examples Example 1: Input: 4 3 2 5 3 Output: 7 Explanation: Sorted goals: [2, 3, 3, 5] Pairing smallest with largest: 2 + 5 = 7 3 + 3 = 6 The maximum of these sums is 7, which is the minimized worst-ca