-
-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathmain.rs
More file actions
22 lines (21 loc) · 537 Bytes
/
main.rs
File metadata and controls
22 lines (21 loc) · 537 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
pub fn main() {
let nums: Vec<usize> = include_str!("../input.txt")
.lines()
.map(|n| n.parse().unwrap())
.collect();
println!(
"{}",
nums.windows(26)
.find(|set| {
for i in 0..24 {
for j in (i + 1)..25 {
if set[i] + set[j] == set[25] {
return false;
}
}
}
true
})
.unwrap()[25]
);
}