1447. Simplified Fractions Medium

@problem@discussion
#Math#String#Number Theory



1/**
2 * [1447] Simplified Fractions
3 *
4 * 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.
5 *  
6 * Example 1:
7 * 
8 * Input: n = 2
9 * Output: ["1/2"]
10 * Explanation: "1/2" is the only unique fraction with a denominator less-than-or-equal-to 2.
11 * 
12 * Example 2:
13 * 
14 * Input: n = 3
15 * Output: ["1/2","1/3","2/3"]
16 * 
17 * Example 3:
18 * 
19 * Input: n = 4
20 * Output: ["1/2","1/3","1/4","2/3","3/4"]
21 * Explanation: "2/4" is not a simplified fraction because it can be simplified to "1/2".
22 * 
23 *  
24 * Constraints:
25 * 
26 * 	1 <= n <= 100
27 * 
28 */
29pub struct Solution {}
30
31// problem: https://leetcode.com/problems/simplified-fractions/
32// discuss: https://leetcode.com/problems/simplified-fractions/discuss/?currentPage=1&orderBy=most_votes&query=
33
34// submission codes start here
35
36impl Solution {
37    pub fn simplified_fractions(n: i32) -> Vec<String> {
38        vec![]
39    }
40}
41
42// submission codes end
43
44#[cfg(test)]
45mod tests {
46    use super::*;
47
48    #[test]
49    fn test_1447() {
50    }
51}
52


Back
© 2025 bowen.ge All Rights Reserved.