You are given an array loads of non-negative integers, where loads[i] is the server load at the i-th of a run of consecutive timestamps. Find every index whose load is strictly greater than twice the average load of the whole array.
Return those indices in ascending order. If no index qualifies, return an empty list.
Function Signature
def high_load_indices(loads: list[int]) -> list[int]:
Rules
-
The average is the sum of all loads divided by the length of the array, taken exactly with no rounding.
-
The comparison is strict: a load equal to twice the average does not qualify.
-
Return the qualifying indices in ascending order.
Constraints
-
1 <= len(loads) <= 10^5
-
0 <= loads[i] <= 10^6
Examples
Input: loads = [10, 5, 3, 50, 2, 8]
Output: [3]
The loads sum to 78 over 6 values, so the average is 13 and the threshold is 26. Only loads[3] = 50 is above 26.
Input: loads = [1, 1, 1, 1, 1]
Output: []
The average is 1 and the threshold is 2. No load exceeds 2.
Input: loads = [3, 1, 1, 1]
Output: []
The loads sum to 6 over 4 values, so the average is 1.5 and the threshold is 3. loads[0] = 3 equals the threshold, and equality does not qualify.