C#: Kth smallest Element in row-wise and column-wise sorted 2D array

Level : Beginner
Mentor: Shailendra Chauhan
Type : GuidedLab
Points : 10
Duration : 00:15:00

Lab Details

Difficulty Level: MEDIUM

Problem Statement:

Given an n x n matrix, where every row and column is sorted in non-decreasing order. Find the kth smallest element in the given 2D array.

Input:

k = 3 and array =

        10, 20, 30, 40

        15, 25, 35, 45

        24, 29, 37, 48

        32, 33, 39, 50

Output:

The 7th smallest element is 30


Self-paced Membership
  • 22+ Video Courses
  • 800+ Hands-On Labs
  • 400+ Quick Notes
  • 55+ Skill Tests
  • 45+ Interview Q&A Courses
  • 10+ Real-world Projects
  • Career Coaching Sessions
  • Email Support
Upto 60% OFF
Know More
Still have some questions? Let's discuss.
CONTACT US
Accept cookies & close this