Given an integer n, return a list of all simplified fractions between 0 and 1 (exclusive) such that the denominator is less-than-or-equal-to n. You can return the answer in any order.

&nbsp;
Example 1:

Input: n = 2
Output: ["1/2"]
Explanation: "1/2" is the only unique fraction with a denominator less-than-or-equal-to 2.


Example 2:

Input: n = 3
Output: ["1/2","1/3","2/3"]


Example 3:

Input: n = 4
Output: ["1/2","1/3","1/4","2/3","3/4"]
Explanation: "2/4" is not a simplified fraction because it can be simplified to "1/2".


&nbsp;
Constraints:


	1 &lt;= n &lt;= 100


class Solution:
    def simplifiedFractions(self, n: int) -> List[str]:
        
        collect = {}
        for b in range(2, n+1):
            for a in range(1, b):
                if a/b not in collect:
                    collect[a/b] = f"{a}/{b}"  
        return list(collect.values())
class Solution {
    public List<String> simplifiedFractions(int n) {
        List<String> list = new ArrayList<>() ;

        for(int numerator = 1; numerator< n ; numerator++) {
            for(int denominator = numerator+1; denominator<=n; denominator++) {
                if(gcd(numerator,denominator) == 1) {
                    list.add(numerator+"/"+denominator);
// System.out.println(numerator+"/"+denominator);
                }
            }
        }
        return list ;
    }

    static int gcd(int a, int b)
    {
// euclidean algo

        if(a==0) {
            return b ;
        }
        return gcd(b%a,a);
    }
}
class Solution {
public:
    bool simplified(int n, int i){
        while(i>0){
            n-=i;
            if(i>n)swap(n,i);
        }
        if(n>1) return false;
        else return true;
    }

    vector<string> simplifiedFractions(int n) {
        vector<string> ans;
        while(n>1){
            int i=1;
            while(i<n){
                if(simplified(n, i)){
                    string fraction;
                    int num=i;
                    while(num>0){
                        fraction.push_back(num%10+'0');
                        num/=10;
                    }
                    fraction.push_back('/');
                    num = n;
                    while(num>0){
                        fraction.push_back(num%10+'0');
                        num/=10;
                    }
                    if(i>9) swap(fraction[0],fraction[1]);
                    if(n>99) swap(fraction[fraction.size()-1],fraction[fraction.size()-3]);
                    else if(n>9) swap(fraction[fraction.size()-1],fraction[fraction.size()-2]);
                    ans.push_back(fraction);
                }
                i++;
            }
            n--;
        }
        return ans;
    }
};
var simplifiedFractions = function(n) {
    const res = [];
    const checkValid = (a, b) => {
        if(a === 1) return 1;
        let num = 2;
        while(num <= a) {
            if(b % num === 0 && a % num === 0) return num;
            num++;
        }
        return 1;
    }
    let i = 1;
    while(i / n < 1) {
        let j = i + 1;
        while(j <= n) {
            if(checkValid(i, j) < 2) {
                res.push(`${i}/${j}`); 
            }
            j++;
        }
        i++;
    }
    return res;
};
Simplified Fractions