So this is a series of programming challenges that have no definitive answer. Anyone is welcome to submit solutions at any time, there are no winners and losers just good times and lulz. Challenges will progressively get more challenging over time.
You get points for creativity, for efficiency and for having fun.
Round 1 - Compression
This round asks you to create a primitive compression algorithm. Specifically an algorithm that takes a string of characters and reduces it such that all recurring characters are represented as the character prefixed by the repetition count. If the repetition count is 1, then the repetition count should be omitted for that character
IE:
- Code: Select all
print compress("aaabbccdefffgg");
// would output 3a2b2cde3f2g
Also, you must write an accompanying decompression algorithm one that would take the compressed string and restore it to it's original form.
Such that:
- Code: Select all
print decompress("3a2b2cde3f2g");
// would output aaabbccdefffgg
With that said, welcome to fight club

Let the fun begin.