Statistics

Problem Statement for "JudgedScoring"

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 int[] scores, which contains the individual scores of all judges, calculate and return your overall score for the event.

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

  1. { 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.

  2. { 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.

  3. { 18, 47, 23, 36, 12 }

    Returns: 77

  4. { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }

    Returns: 44

  5. { 1, 1, 1 }

    Returns: 1

  6. {1, 1, 1 }

    Returns: 1


This problem statement is the exclusive and proprietary property of TopCoder, Inc. Any unauthorized use or reproduction of this information without the prior written consent of TopCoder, Inc. is strictly prohibited. (c)2024, TopCoder, Inc. All rights reserved.
This problem was used for: