#3462
Maximum Sum With at Most K Elements
specialist · 710 · lc medium +30 · 60.6% accepted · 109 likes · top 59%
Description
Given an n x m integer matrix grid, a per-row limit array limits, and an integer k, select at most k elements from the matrix such that no more than limits[i] elements come from row i.
Return the maximum possible sum of the selected elements.
Code
1
2
3