EPIJudge icon indicating copy to clipboard operation
EPIJudge copied to clipboard

Ambiguous problem statement for Search in two Sorted Arrays

Open zorro786 opened this issue 5 years ago • 2 comments

You are given two sorted arrays and a positive integer k. Design an algorithm for computing the kth smallest element in an array consisting of the elements of the initial two arrays arranged in sorted order. Array elements may be duplicated within and across the input arrays.

The problem statement doesn't specify if it should be kth smallest distinct element or kth element in combined sorted order of two arrays. For me the last statement makes it lean more towards kth smallest distinct element by mentioning presence of duplicates across two arrays.

zorro786 avatar Jan 15 '20 07:01 zorro786

Also the file name should be KthSmallestElementInTwoSortedArrays and not KthLargestElementInTwoSortedArrays

zorro786 avatar Jan 15 '20 08:01 zorro786

Hi @zorro786 ,

About the file name issue, you are right that I just renamed it accordingly.

Conventionally, without explicitly specified distinct, kth element is pretty straightforward. I am surprised that mentioning arrays might have duplicates will cause confusions but we will look at that to see how could we either removing that or reword in a way to make it more clear.

tsunghsienlee avatar Jan 21 '20 08:01 tsunghsienlee