my-solutions/advent-of-code/2024/day_09/lib.h

26 lines
477 B
C

#pragma once
struct Vec{
size_t length;
int* data;
};
/**
* Expand compressed disk map.
* For example, expand_blocks("123") returns [0, -1, -1, 1, 1, 1].
* The caller must free the memory of the returned array.
*/
struct Vec expand_disk_map(char*);
/**
* Compress the data in-place.
*/
void compress_fs(struct Vec);
/**
* Move the blocks in-place.
*/
void compress_fs_by_blocks(struct Vec);
long calc_checksum(struct Vec);
struct Vec copy_vec(struct Vec);