Skip to content

Practice Minimum Average Difference

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

Medium#2256
LeetCode Problem

Minimum Average Difference

Problem Statement

For every i, compare the averages of nums[0..i] and nums[i+1..end], rounding each average down separately. An empty right part has average 0. Return the smallest index attaining the least absolute difference between these averages.

Source: Minimum Average Difference on LeetCode. Use the original task for its coding environment and submissions.

Examples

# Example 1

Input
nums = [2,5,3,9,5,3]
Output
3

# Example 2

Input
nums = [0]
Output
0

Constraints

1 <= nums.length <= 10^5
0 <= nums[i] <= 10^5

Related LeetCode Problems

Practice more problems similar to Minimum Average Difference.

Review your practice with PhantomCodeAI

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