• Courses
  • Tutorials
  • DSA
  • Data Science
  • Web Tech
August 13, 2024 |50 Views

SDE Sheet - Kth Smallest Element in a Row-Column Wise Sorted Matrix

Description
Discussion

This video is part of the Heap section under GFG SDE Sheet.

Given a N x N matrix, where every row and column is sorted in non-decreasing order. Find the kth smallest element in the matrix.

Example 1:

Input: N = 4 mat[][] =     {{16, 28, 60, 64},                   {22, 41, 63, 91},                   {27, 50, 87, 93},                   {36, 78, 87, 94 }} K = 3 Output: 27 Explanation: 27 is the 3rd smallest element.

Try it out before watching the implementation of the problem in the video. We recommend watching the video, even if you can solve the problem. You may discover something new. All the best!!!

Do check out:-
Problem: https://www.geeksforgeeks.org/problems/kth-element-in-matrix/1
SDE Sheet Link: https://www.geeksforgeeks.org/sde-sheet-a-complete-guide-for-sde-preparation/
Article Link: https://www.geeksforgeeks.org/kth-smallest-element-in-a-row-wise-and-column-wise-sorted-2d-array/