FunctionRacerProblemsRace

Group Maximums

EasyNumPyPython

Cut arr into consecutive groups of size numbers (the first group is items 0 to size - 1, and so on) and return the largest value of each group as a list. len(arr) is always a multiple of size.

Example 1

arr [1,9,3,4,8,2]
size 3
returns [9,8]

The groups are [1, 9, 3] and [4, 8, 2].

Constraints

Race itor take your time

Write it in your browser, against the clock. The model solution, stepped through line by line, comes after.

More NumPy problems