rustgym 0.2.0

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

impl Solution {
    fn arrange_coins(n: i32) -> i32 {
        (((2 * n as i64) as f64 + 0.25).sqrt() - 0.5).floor() as i32
    }
}

#[test]
fn test() {
    assert_eq!(Solution::arrange_coins(5), 2);
    assert_eq!(Solution::arrange_coins(8), 3);
    assert_eq!(Solution::arrange_coins(1_804_289_383), 60070);
}