
Asked in Sigmoid
K-th Element of Two Sorted Arrays
You are provided with two sorted arrays, arr1
and arr2
, along with an integer k
. By merging all elements from arr1
and arr2
into a new sorted array, your task is to identify the k
th smallest element in this combined array.
Example:
Input:
arr1 = [2,3,45]
arr2 = [4,6,7,8]
k = 4
Output:
6
Explanation:
The merged array is [2,3,4,6,7,8,45]
. The fourth element of this merged array is 6
; hence the output is 6
.
Constraints:
- 1 <= T <= 100
- 1 <= M <= 5000
- 1 <= N <= 5000
- -109 <= arr1[i], arr2[i] <= 109
Note that T
represents the number of test cases, and M
and N
denote the sizes of arr1
and arr2
, respectively. Arrays arr1
and arr2
are sorted.

AnswerBot
1y
The task is to find the kth smallest element of a merged array created by merging two sorted arrays.
Merge the two sorted arrays into a single sorted array
Return the kth element of the merged array
Anonymous
4mo
This can be solved by heap max
Help your peers!
Add answer anonymously...
Top Data Engineer Interview Questions Asked at Sigmoid
Q. How would you sort an array containing only 0s and 1s?
Q. Given a matrix, traverse and print its elements in a spiral manner.
Q. Given the head of a singly linked list, determine if the linked list has a cycle...read more
Interview Questions Asked to Data Engineer at Other Companies
Top Skill-Based Questions for Sigmoid Data Engineer
Big Data Interview Questions and Answers
500 Questions
Python Interview Questions and Answers
400 Questions
SQL Interview Questions and Answers
250 Questions
Cloud Computing Interview Questions and Answers
250 Questions
Data Structures Interview Questions and Answers
250 Questions
Spark Interview Questions and Answers
50 Questions
Stay ahead in your career. Get AmbitionBox app


Trusted by over 1.5 Crore job seekers to find their right fit company
80 L+
Reviews
10L+
Interviews
4 Cr+
Salaries
1.5 Cr+
Users
Contribute to help millions
AmbitionBox Awards
Get AmbitionBox app

