Posted on

Description

Submission

class Solution {
public:
    vector<string> simplifiedFractions(int n) {
        vector<string> rets;

        for(int j = 2; j <= n; ++j) {
            for(int i = 1; i < j; ++i) {
                if(gcd(j, i) == 1) rets.push_back(to_string(i) + "/" + to_string(j));
            }
        }

        return rets;
    }
};

Leave a Reply

Your email address will not be published. Required fields are marked *