Free written solution

K-th Smallest Prime Fraction (LeetCode 786): Solution and Explanation

Given a sorted array of 1 and distinct primes, look at every fraction arr[i] / arr[j] with i < j and return the kth smallest one as [numerator, denominator].

Read the intuition, approach, code and complexity →