Minimum Average Difference
Given an array nums of integers with length n, find the index i with the minimum average difference between the averages of the first i + 1 elements and the averages of the last n - i - 1 elements. If there are multiple indices with the minimum average difference, print the smallest one.
Note:
- The average difference of two numbers is the absolute difference between their averages, rounded down to the nearest integer.
- The average of a set of numbers is calculated by dividing their sum by the number of elements (using integer division). The average of 0 elements is considered to be 0.
Ada AI
I want to discuss a solution
Help me solve this
Give more examples
What's wrong with my code?
How to use 'for loop' in javascript?
javascript (node 13.12.0)