Welcome to the daily solving of our PROBLEM OF THE DAY with Nitin Kaplas We will discuss the entire problem step-by-step and work towards developing an optimized solution. This will not only help you brush up on your concepts of Arrays but also build up problem-solving skills.
Given an array arr[] and an integer k where k is smaller than the size of the array, the task is to find the kth smallest element in the given array. It is given that all array elements are distinct.
Follow up: Don't solve it using the inbuilt sort function.
Examples :
Input:arr[] = 7 10 4 3 20 15, k = 3
Output : 7
Explanation :3rd smallest element in the given array is 7.
Give the problem a try before going through the video. All the best!!!
Problem Link: https://practice.geeksforgeeks.org/problems/kth-smallest-element5635/1