We’re preparing your current view and syncing the latest data.
Find Score Difference
gfgYou are given an array of integers representing scores achieved by players in a game. Your task is to find the difference between the highest score and the lowest score.
This difference represents the variability in the game scores and can be used to analyze the competitiveness or disparity among players.
An array of integers where each integer represents a player's score.
An integer representing the difference between the maximum and minimum score.
The array will contain at least one score. Scores can be positive, zero, or negative integers.
Example 1
Input
[3, 8, 15, 6, 4]
Output
12
Explanation
The maximum score is 15 and the minimum is 3, so the difference is 15 - 3 = 12.