Day 15, small cleanup
This commit is contained in:
parent
e9e7478fe2
commit
ce55569030
1 changed files with 1 additions and 2 deletions
|
@ -49,8 +49,7 @@ fn get_number(start: &[usize], num_turns: usize) -> usize {
|
||||||
let mut nums = start.to_vec();
|
let mut nums = start.to_vec();
|
||||||
let mut num=std::usize::MAX;
|
let mut num=std::usize::MAX;
|
||||||
for i in 1..num_turns {
|
for i in 1..num_turns {
|
||||||
let e = cache.entry(nums[i - 1]).or_default();
|
num = cache.entry(nums[i - 1]).or_default().add(i);
|
||||||
num=e.add(i);
|
|
||||||
if i >= nums.len() {
|
if i >= nums.len() {
|
||||||
nums.push(num);
|
nums.push(num);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue