Problem Statement
You are competing in an event where the score is determined by a panel of at least three judges. Each judge does their scoring independently. To determine your overall score, the highest and lowest scores are discarded, and all remaining scores are summed together.
Given the
Definition
- Class:
- JudgedScoring
- Method:
- overallScore
- Parameters:
- int[]
- Returns:
- int
- Method signature:
- int overallScore(int[] scores)
- (be sure your method is public)
Constraints
- scores will contain between 3 and 50 elements, inclusive.
- Each element of scores will be between 0 and 100, inclusive.
Examples
{ 5, 3, 2, 4 }
Returns: 7
The low score of 2 and the high score of 5 are ignored. Your overall score is therefore 3 + 4 = 7.
{ 1, 1, 2, 3, 4 }
Returns: 6
Note that if two or more scores are tied for being the lowest (or highest) only one gets ignored.
{ 18, 47, 23, 36, 12 }
Returns: 77
{ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }
Returns: 44
{ 1, 1, 1 }
Returns: 1
{1, 1, 1 }
Returns: 1