Google | Phone Screen | Print Fractions
Anonymous User
1503

Print all the fractions from 0 to 1 with N being the highest denominator. The fractions must be printed in order. If duplicate fraction values are found, then print the fraction in the lowest form. For example, If you have 1/2 and 5/10, then only 1/2 would printed.

Example

Input: n = 4
Output: ["0/1", "1/4", "1/3", "1/2", "2/3", "3/4", "1/1"]
Comments (10)