SEAGATE Hiring | Finding Kth Smallest Element | Heap

Question · Posted Jun 2026

Problem Statement You are given an n × n matrix where: Each row is sorted in ascending order. Each column is sorted in ascending order. Return the kth smallest element in the matrix. Note that it is the kth smallest element in the sorted order of all elements in the matrix, not the kth distinct element. You must solve the problem using O(n) extra space. Example 1 Input matrix = [  [1,5,9],  [10,11,13],  [12,13,15] ] k = 8 Output 13 ...

The full answer & interview discussion are available to premium members.

Log in Create a free account