• Courses
  • Tutorials
  • Jobs
  • Practice
  • Contests
May 07, 2024 |460 Views
SDE Sheet - K-th element of two sorted Arrays
  Share   Like
Description
Discussion

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

In this problem, we are given two sorted arrays arr1 and arr2 of size N and M respectively and an element K. The task is to find the element that would be at the kth position of the final sorted array.

Example :

Input:
arr1[] = {2, 3, 6, 7, 9}
arr2[] = {1, 4, 8, 10}
k = 5
Output:
6
Explanation:
The final sorted array would be -1, 2, 3, 4, 6, 7, 8, 9, 10. The 5th element of this array is 6.

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:-
Article: https://www.geeksforgeeks.org/k-th-element-two-sorted-arrays/
Problem: https://www.geeksforgeeks.org/problems/k-th-element-of-two-sorted-array1317/1
SDE Sheet Link: https://www.geeksforgeeks.org/sde-sheet-a-complete-guide-for-sde-preparation/