This commit is contained in:
parent
9b8ae4f350
commit
b5583ca46e
@ -46,14 +46,10 @@ fn solve(alloc: mem.Allocator, input: []const u8) !Solution {
|
||||
// Extrapolate
|
||||
var next: isize = 0;
|
||||
var prev: isize = 0;
|
||||
for (seqs.items) |seq| {
|
||||
next += seq[seq.len - 1];
|
||||
}
|
||||
for (0..seqs.items.len) |i| {
|
||||
prev = seqs.items[seqs.items.len - i - 1][0] - prev;
|
||||
}
|
||||
for (seqs.items) |seq| {
|
||||
// Clean up
|
||||
const seq = seqs.items[seqs.items.len - i - 1];
|
||||
prev = seq[0] - prev;
|
||||
next += seq[seq.len - 1];
|
||||
alloc.free(seq);
|
||||
}
|
||||
prev_sum += prev;
|
||||
|
Loading…
Reference in New Issue
Block a user