Last active
May 17, 2023 00:42
-
-
Save chase-lambert/3da8760f22988b8f542562fe5817c2e8 to your computer and use it in GitHub Desktop.
rendezvous with cassidoo challenge: 23.01.29
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pub fn generate_arrays(n: i32) -> Vec<Vec<i32>> { | |
(1..=n).map(|x| (1..=x).collect()).collect() | |
} | |
#[test] | |
fn generate_arrays_test() { | |
assert_eq!( | |
generate_arrays(4), | |
vec![vec![1], vec![1, 2], vec![1, 2, 3], vec![1, 2, 3, 4]] | |
); | |
assert_eq!(generate_arrays(1), vec![vec![1]]); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment