Kth Smallest element in a matrix | Leetcode #378

preview_player
Показать описание
🟣 JOIN our 𝐋𝐈𝐕𝐄 𝐢𝐧𝐭𝐞𝐫𝐯𝐢𝐞𝐰 𝐭𝐫𝐚𝐢𝐧𝐢𝐧𝐠 𝐩𝐫𝐨𝐠𝐫𝐚𝐦 through whatsapp query: +91 8918633037

This video explains how to find the kth smallest element in a matrix. We have discussed multiple techniques for solving this problem starting from bruteforce to heap and ending with the most optimal binary search technique.

----------------------------------------------------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------------------------------------------------
Рекомендации по теме
Комментарии
Автор

A very important point to mention here is that mid element may or may not exists the the matrix
But since with keep high = mid (even for the case count_smaller == k), we sort of tend to converge to the lowest element in the matrix where count_smaller == k.

Hope this helps, if not I will post link to the solution where I have written print stmt to have full clarity

AkashGupta-shpd
Автор

Thanks Bhaiya, Awesome explanation as usual.

hymnish_you
Автор

We can optimise the count function! Using 2 pointers! You can look into the discussion section

debapriyachandra
Автор

The best video for this problem so far

RishinderRana