K-th Smallest Prime Fraction

You are given a sorted integer array containing numbers that are 1 and prime numbers, all unique. For each pair of indices i and j where i < j, consider the fraction arr[i] / arr[j]. Return the k-th smallest fraction in the form of an array [arr[i], arr[j]].

Constraints

  • 2 <= arr.length <= 1000
  • 1 <= arr[i] <= 3 * 10^4
  • arr[0] == 1
  • arr[i] is a prime number for i > 0
  • All the numbers of arr are unique and sorted in strictly increasing order.
  • 1 <= k <= arr.length * (arr.length - 1) / 2
Saving… · 2 lines
class Solution:
def kthSmallestPrimeFraction(self, arr: List[int], k: int) -> List[int]:
Console

Click Run to execute sample tests.