Skip to content

Commit

Permalink
comment
Browse files Browse the repository at this point in the history
  • Loading branch information
K20shores committed Dec 9, 2024
1 parent a01d064 commit 2af2bd8
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions 2024/src/day9.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ long long checksum(std::list<std::pair<int, int>> diskmap) {
long long part1(const Data &data)
{
auto diskmap = data.diskmap;
// print(diskmap);

auto left = diskmap.begin();
auto right = --diskmap.end();
Expand All @@ -78,6 +77,7 @@ long long part1(const Data &data)
// there is enough space to entirely fit the right block
left->first = right->first;
left->second = right->second;
// insert the remaining space to the right
diskmap.insert(std::next(left), {-1, remaining_space - needed_space});
right->first = -1;
}
Expand All @@ -89,10 +89,8 @@ long long part1(const Data &data)
right->second -= remaining_space;
diskmap.insert(std::next(right), {-1, remaining_space});
}
// print(diskmap);
}

// print(diskmap);
return checksum(diskmap);
}

Expand Down

0 comments on commit 2af2bd8

Please sign in to comment.