Leetcode 3462. Maximum Sum With at Most K Elements
Pick up to k elements from an n×m matrix to maximize their total value, with the extra constraint that you may take at most limits[i] elements from row i. The core algorithmic pattern is converting each row into choices of taking t top elements (prefix sums) and solving a multiple-choice/0-1 knapsack over capacity k to combine rows optimally.
Question Timeline
See when this question was last asked and where, including any notes left by other candidates.
0
Hello Interview Premium
Your account is free and you can post anonymously if you choose.