Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Heap: Given a n x n matrix where each of the rows and columns are sorted in ascending order, findthe kth smallest element in the matrix in Python #1747

Open
akgmage opened this issue Oct 15, 2023 · 0 comments
Labels

Comments

@akgmage
Copy link
Owner

akgmage commented Oct 15, 2023

Note that it is the kth smallest element in the sorted order, not the kth distinct element.

Example:
Input:
matrix = [
[ 1, 5, 9],
[10, 11, 13],
[12, 13, 15]
],
k = 8,
Output: 13
Note:
You may assume k is always valid, 1 ≤ k ≤ n^2. You may also assume that 1 <= n <= 1000.

@akgmage akgmage added the Heap label Oct 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant