init
This commit is contained in:
7
problems/p24/Cargo.toml
Normal file
7
problems/p24/Cargo.toml
Normal file
@@ -0,0 +1,7 @@
|
||||
[package]
|
||||
name = "p24"
|
||||
version = "0.1.0"
|
||||
edition = "2024"
|
||||
|
||||
[dependencies]
|
||||
itertools = { workspace = true }
|
||||
18
problems/p24/src/main.rs
Normal file
18
problems/p24/src/main.rs
Normal file
@@ -0,0 +1,18 @@
|
||||
use itertools::Itertools;
|
||||
|
||||
fn get_n(elements: Vec<String>, n: usize) -> String {
|
||||
elements
|
||||
.iter()
|
||||
.permutations(elements.len())
|
||||
.nth(n)
|
||||
.unwrap()
|
||||
.iter()
|
||||
.map(|s| s.as_str())
|
||||
.collect::<String>()
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let elements = (0..=9).map(|x| x.to_string()).collect::<Vec<String>>();
|
||||
let result = get_n(elements, 1000000 - 1);
|
||||
println!("{result}");
|
||||
}
|
||||
Reference in New Issue
Block a user