rustgym 0.2.0

rustgym solutions
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
struct Solution;

impl Solution {
    fn construct_rectangle(area: i32) -> Vec<i32> {
        let mut max = (area as f64).sqrt().floor() as i32;
        while area % max != 0 {
            max -= 1;
        }
        vec![area / max, max]
    }
}

#[test]
fn test() {
    assert_eq!(Solution::construct_rectangle(4), vec![2, 2]);
}