Skip to content

Practice Minimum Average of Smallest and Largest Elements

Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.

Easy#3194
LeetCode Problem

Minimum Average of Smallest and Largest Elements

Problem Statement

Given an even-length array nums, repeatedly remove one smallest and one largest remaining element and record their average. Continue until the array is empty. Return the smallest of the recorded averages.

Source: Minimum Average of Smallest and Largest Elements on LeetCode. Use the original task for its coding environment and submissions.

Examples

# Example 1

Input
nums = [7,8,3,4,15,13,4,1]
Output
5.5

# Example 2

Input
nums = [1,9,8,3,10,5]
Output
5.5

# Example 3

Input
nums = [1,2,3,7,8,9]
Output
5.0

Constraints

2 <= n == nums.length <= 50
n is even.
1 <= nums[i] <= 50

Related LeetCode Problems

Practice more problems similar to Minimum Average of Smallest and Largest Elements.

Review your practice with PhantomCodeAI

After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.