K-th Smallest Prime Fraction

Medium · Heap & Priority Queue · about 25 minutes

Asked at Amazon, Google, Microsoft.

arr is sorted, contains 1 and distinct primes. Consider every fraction arr[i] / arr[j] with i < j. Return the k-th smallest fraction as [arr[i], arr[j]].

Related guides