#3833

Count Dominant Indices

pupil · 335 · lc easy +22 · 65.7% accepted · 47 likes · top 71%

Description

Given an integer array nums of length n, index i is dominant when nums[i] strictly exceeds the average of all elements to its right: average(nums[i+1], nums[i+2], ..., nums[n-1]). The rightmost element is never dominant. Count and return the number of dominant indices.

Code

1
2
3