Cells Above Row Average
Return how many cells of the 2-D array grid are strictly greater than the average of the row they sit in. Hint: grid.mean(axis=1, keepdims=True) gives column of averages that broadcasts against grid.
Example 1
grid [[1,2,6],[5,5,5]]
returns 1
Row 0 averages 3, and only 6 is above it. Row 1 averages 5 and nothing is above it.
Constraints
1 <= rows, columns <= 10
Write it in your browser, against the clock. The model solution, stepped through line by line, comes after.
More NumPy problems
- Count Local PeaksMedium
- Deepest Fall From a HighMedium
- Distance From a CellMedium
- Halfway PointMedium
- Highest Cell PositionMedium
- Matching PairsMedium
- Mean of Each GroupMedium
- Multiplication TableMedium