Practice Find the Kth Smallest Sum of a Matrix With Sorted Rows
Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.
Hard#1439
LeetCode ProblemFind the Kth Smallest Sum of a Matrix With Sorted Rows
Problem Statement
You are given an m x n matrix mat that has its rows sorted in non-decreasing order and an integer k. You are allowed to choose exactly one element from each row to form an array. Return the kth smallest array sum among all possible arrays.
Source: Find the Kth Smallest Sum of a Matrix With Sorted Rows on LeetCode. Use the original task for its coding environment and submissions.
Examples
# Example 1
Input
mat = [[1,3,11],[2,4,6]], k = 5
Output
7
# Example 2
Input
mat = [[1,3,11],[2,4,6]], k = 9
Output
17
# Example 3
Input
mat = [[1,10,10],[1,4,5],[2,3,6]], k = 7
Output
9
Constraints
m == mat.length
n == mat[i].length
1 <= m, n <= 40
1 <= mat[i][j] <= 5000
1 <= k <= min(200, n^m)
mat[i] is a non-decreasing array.
Related LeetCode Problems
Practice more problems similar to Find the Kth Smallest Sum of a Matrix With Sorted Rows.
Review your practice with PhantomCodeAI
After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.