K-th Element of Two Sorted Arrays
Problem Statement
Problem Statement
Input: 'arr1' = [2, 3, 45], 'arr2' = [4, 6, 7, 8] and 'k' = 4
Output: 6
Explanation: The merged array will be [2, 3, 4, 6, 7, 8, 45]. The element at position '4' of this array is 6. Hence we return 6.The first line contains ‘n’ denoting the number of elements in ‘arr1’.
The second line contains ‘n’ space-separated integers denoting the elements of ‘arr1’.
The third line contains ‘m’ denoting the number of elements in ‘arr2’.
The fourth line contains ‘m’ space-separated integers denoting the elements of ‘arr2’.
The fifth line contains an integer ‘k’.Intuition
Links
Video Links
Approach 1:
Approach 2:
Approach 3:
Approach 4:
Similar Problems
Last updated