Group Maximums
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
1 <= len(arr) <= 60len(arr)is a multiple ofsize
Write it in your browser, against the clock. The model solution, stepped through line by line, comes after.
More NumPy problems
- Is SortedEasy
- Is SymmetricEasy
- Largest GapEasy
- Latest PeakEasy
- Merge and SortEasy
- Missing NumbersEasy
- Most Common ValueEasy
- Most Different PositionEasy