Back to course home
0% completed
Vote For New Content
K-th Smallest Prime Fraction (medium)
Problem Statement
You are given a sorted list of numbers that includes the number 1 and unique prime numbers. You are also given an integer k.
For every pair of indexes i and j, where 0 <= i < j < arr.length, we consider the fraction arr[i] / arr[j].
Find the K-th smallest fraction from these pairs, and return this fraction as an array containing the numerator and the denominator.
Examples
Example 1
- Input: arr = [1, 3, 5], k = 3
- Output: [3, 5]
- Explanation: The fractions are 1/3, 1/5, and 3/5. The sorted order is 1/5, 1/3, and 3/5
.....
.....
.....
Like the course? Get enrolled and start learning!