K Th Smallest Prime Fraction, is a LeetCode problem. In this post we will see how we can solve this challenge in Python

Problem Description

Examples: Input: A = [1, 2, 3, 5], K = 3 Output: [2, 5] Explanation: The fractions to be considered in sorted order are: 1/5, 1/3, 2/5, 1/2, 3/5, 2/3. The third fraction is 2/5.

Input: A = [1, 7], K = 1 Output: [1, 7]

Note:

....

You can find the full details of the problem K th Smallest Prime Fraction at LeetCode

Solution: Please check the main.py snippet for the solution.

This solution originally posted at: Github by @kamyu104