Skip to main content

Questions tagged [compression]

Related to compressing or decompressing arbitrary data. Challenges which relate to compressing a single specific input should instead be tagged [kolmogorov-complexity]

Filter by
Sorted by
Tagged with
19 votes
21 answers
2k views

The JavaScript compressor RegPack uses a very simple string compression algorithm. Given a piece of code, it will make a list of characters that aren't used in that code and use them to delimit ...
emanresu A's user avatar
  • 46.2k
17 votes
14 answers
3k views

This is the reverse of this challenge. Given an encoded list of codepoints and the characters used to encode it, you need to decompress it to its original string. For example, given the encoded list <...
naffetS's user avatar
  • 13.1k
10 votes
7 answers
537 views

Challenge: Given an integer \$n\$, guaranteed to be \$\geq2\$ and a power of 2, we are going to draw multiply boards either side-by-side or below one another, where the first has dimensions of \$n\$ ...
Kevin Cruijssen's user avatar
24 votes
17 answers
4k views

Given a string and the characters used to encode it, you need to compress the string by only using as many bits as each character needs. You will return the character codes for each character needed ...
naffetS's user avatar
  • 13.1k
-4 votes
1 answer
308 views

Choose a language and write a program in the language that: Take a valid program of the language as input, Output a string(bytearray, etc.). It needn't be a valid program. Only finite valid inputs ...
l4m2's user avatar
  • 32.5k
14 votes
8 answers
834 views

Your task is to make a bidirectional compressor. It takes a list of bytes as input and returns a list of bytes as output. It has the property than whenever it is iterated twice it returns the original ...
AnttiP's user avatar
  • 8,048
11 votes
2 answers
831 views

The objective is to make the smallest SB3 file that can simply be imported into Scratch 3.0 without a "The project file that was selected failed to load" error. Any means can be used, like ...
Niall Ward's user avatar
12 votes
3 answers
946 views

The golfing language Jelly has a very complex and clever string compression system which I'm not going to go into depth about here. You can find a very good explanation here. Basically, Jelly's string ...
emanresu A's user avatar
  • 46.2k
14 votes
2 answers
560 views

Try it online! currently has 680 listed languages, all of which are searchable. For most of those languages, when searching for it, you don't have to enter the entire string. For example, entering <...
caird coinheringaahing's user avatar
50 votes
7 answers
7k views

A zip bomb is a compressed file, designed so that unpacking it yields the biggest file possible. These are fairly well known, and there are examples of 42 KB files which expand into multiple petabytes ...
rydwolf's user avatar
  • 19.3k
21 votes
3 answers
686 views

Jelly has compressed string literals, using the “...» delimiters. The way these work is by interpreting the ... as a base-250 ...
caird coinheringaahing's user avatar
12 votes
9 answers
2k views

using Prefixed Length Code We are going to implement a compression of text (string, array/list of characters/bytes) by simple substitution of each character by a binary code, based on the frequency of ...
Galen Ivanov's user avatar
  • 21.5k
10 votes
5 answers
1k views

The TV series "Breaking Bad" replaced the letters Br and Ba with a periodic-table like representation, printing [Br35]eaking [Ba56]d. Create a program ...
Zsolt Szilagy's user avatar
32 votes
20 answers
3k views

Given a distance in meters as an integer \$60\le d \le 260\$, return the number of clubs that may be used according to the following arbitrary chart, where both \$min\$ and \$max\$ are inclusive: <...
Arnauld's user avatar
  • 206k
25 votes
14 answers
2k views

Put simply, you are to print out the following number: ...
d01's user avatar
  • 3,508
11 votes
10 answers
2k views

Background The game Grand Theft Auto: San Andreas went down in history also thanks to its wide selection of cheats. They're almost 90 and anyone who has ever touched this game, no doubt has tried ...
Domenico's user avatar
  • 2,463
38 votes
11 answers
2k views

The task Today's special offer: consonants and punctuation for FREE! Your program or function will be given as input the first 6 paragraphs of Lewis Carroll's famous novel Alice's Adventures in ...
Arnauld's user avatar
  • 206k
21 votes
39 answers
2k views

Given a word, your task is to compact it by saving its first character and removing any other vowel (aeiou). Input Your input can be the word in STDIN, a function argument or any other input format ...
Command Master's user avatar
19 votes
14 answers
3k views

Given a compressed string \$s\$ made of printable ASCII characters (32 to 126), your task is to print or return the original text by applying this simple decompression algorithm: Start with \$k=0\$ ...
Arnauld's user avatar
  • 206k
3 votes
0 answers
197 views

Write a program that when given a string \$S\$, it generates a program of the same language as itself. The generated program, when given a continuous substring of \$S\$, should predict the next ...
user avatar
9 votes
1 answer
511 views

In golf, a knowledgable caddie helps an already good golfer to be even better. In this challenge, you build a "caddie" to help you code golf. In particular, your caddie will compress golfed code in ...
Dustin G. Mixon's user avatar
30 votes
17 answers
7k views

Can you recover a sequence of letters from a sequence of dots and dashes? In Morse code, x is represented by -..-, but without ...
Dustin G. Mixon's user avatar
3 votes
4 answers
688 views

Background Malbolge is truly intriguing language. But programs written in it are also extraordinairly huge (and in some cases, unpostable on PPCG). Your challenge (shall you accept it) is, to ...
Kamila Szewczyk's user avatar
14 votes
1 answer
1k views

"A picture is worth a thousand words"—so the old saying goes. The average word is about four characters long, so a picture conveys 4kB of information. But how much entropy, rather than information, ...
Purple P's user avatar
  • 1,687
10 votes
2 answers
2k views

Challenge Design a compression algorithm specialized for compressing ASCII mazes. You will need to create both a compression algorithm and a decompression algorithm. Your score will be based on the ...
Beefster's user avatar
  • 10k
2 votes
7 answers
445 views

Challenge Given two non negative integers a < b, output all countries, from the below Top 100 Countries, where area is between ...
mdahmoune's user avatar
  • 3,062
6 votes
4 answers
3k views

Matlab has a useful command for visualizing data: plot. It draws data points using "markers" in 2-D space, connecting them with lines; however, for this challenge, ...
anatolyg's user avatar
  • 14.1k
3 votes
5 answers
566 views

Write two programs A and B. Program A (the encoder) takes 1024 pairs of integers \$(k,v)\$, where \$0≤k<2^{32}\$ and \$0≤v<1024\$, and all \$k\$ will be different. It will output a single ...
l4m2's user avatar
  • 32.5k
11 votes
34 answers
2k views

For a computer language, a reserved word is a word that cannot be used as an identifier, such as the name of a variable, function, or label. For other computer languages, keywords can be considered as ...
mdahmoune's user avatar
  • 3,062
8 votes
3 answers
679 views

Inspired by both the challenge "Unique is Cheap" by @Laikoni, where the score is based on the challenge itself, as well as the JavaScript (ES6) answer of @ETHproductions for the "...
Kevin Cruijssen's user avatar
22 votes
10 answers
2k views

This is a different type of compression challenge. In a normal kolmogorov-complexity challenge, you are required to recreate a list exactly. Here, you are allowed to round the values in any way you ...
PhiNotPi's user avatar
  • 29.3k
37 votes
18 answers
4k views

Your challenge is to expand some brackets in a program's input as shown: Find a string s between two matching brackets [ and ], ...
MD XF's user avatar
  • 14.3k
14 votes
4 answers
1k views

Challenge Write a program that compresses and decompresses ASCII text losslessly. It should be specialized to work well with palindromes, including case-insensitive and punctuation-insensitive ...
Beefster's user avatar
  • 10k
322 votes
24 answers
47k views

Here is a 1.2Mb ASCII text file containing the text of Herman Melville's Moby-Dick; or, The Whale. Your task is to write a program or function (or class, etc. -- see below) which will be given this ...
N. Virgo's user avatar
  • 7,446
27 votes
8 answers
3k views

The London Underground A.K.A. The Tube is the oldest underground railway in the world, it currently consists of eleven lines* servicing 267 named stations (strictly 269** stations since "Edgware ...
Jonathan Allan's user avatar
10 votes
12 answers
2k views

Sales taxes in the United States are complicated, to say the least. Generally, there's a state sales tax (there are a handful of states that do not collect a state sales tax), but there could also be ...
AdmBorkBork's user avatar
  • 43.7k
20 votes
12 answers
4k views

Many programming languages are written using solely printable ASCII, tabs and newlines. These 97 characters are then stored in 8-bit bytes (which are actually capable of holding 256 different ...
Sanchises's user avatar
  • 9,536
10 votes
2 answers
2k views

Inspiration: Heavily inspired by Smallest chess board compression I decided to make a similar but distinctly different competition. tl;dr Take the file Chess_Games.txt and compress it as much as ...
edggy's user avatar
  • 245
12 votes
6 answers
7k views

This question is based on what I came up with to answer another question. Sometimes the questions here ask to draw some ASCII art. One simple way to store the data for the art is RLE (run-length ...
Charlie's user avatar
  • 13k
-7 votes
2 answers
342 views

Your job is to output the html of the current version (at the time of this writing) of the Wikipedia page for Kolmogorov complexity: https://en.wikipedia.org/w/index.php?title=Kolmogorov_complexity&...
Christopher King's user avatar
30 votes
11 answers
2k views

This task is about compressing and processing a sequence of conditionals. In the game Keep Talking and Nobody Explodes, a bomb defuser must disarm a bomb with the help of instructions relayed by ...
xnor's user avatar
  • 150k
11 votes
13 answers
2k views

Maybe some of you already know this game: you have a collection of jelly beans of different colors. For every color, the bean can have different tastes, some are good and some are bad, and you cannot ...
Charlie's user avatar
  • 13k
25 votes
1 answer
892 views

Background As noted in the PPCG challenge Compress a maximal discrepancy-2 sequence – which inspired this challenge – the authors of the paper Computer-Aided Proof of Erdős Discrepancy Properties ...
Dennis's user avatar
  • 212k
29 votes
24 answers
3k views

0xUsernames There's so many people using a messaging service that they're running out of space to store all the usernames! To fix this, they are going to start storing usernames as hexadecimal, where ...
FlipTack's user avatar
  • 14.7k
36 votes
10 answers
3k views

Background The computer game NetHack dates from 1987, before the use of graphics in computer games was widely established. There are lots of monsters in the game, and potentially a lot need to fit on ...
user avatar
9 votes
1 answer
2k views

Background This question is similar to this one. I have provided all of the information needed below. If you are familiar with the other challenge then note that we are ranking all defenses instead ...
Devin White's user avatar
1 vote
0 answers
235 views

Challenge: Write a lossless encoder/decoder that is able to compress its own source code. Usage: progname encode Encodes ...
Leon's user avatar
  • 327
8 votes
10 answers
2k views

Challenge You must write an encoder (and a separate decoder) which takes a string as input and outputs the string encoded in the style of a strand of DNA. DNA DNA is made up of four types of ...
Beta Decay's user avatar
  • 23.6k
2 votes
0 answers
546 views

Your task is to, given an image, compress it to 100000 bytes or less, while following all of the below rules: No cheating/loopholes. Your code must not be optimized to work best only on the test set ...
CodingGolfHockey's user avatar
20 votes
1 answer
649 views

For this challenge, you need to compress a diff. A diff is some data that represents the difference between two strings. For this challenge, you need to provide one or more programs that can: Input <...
Nathan Merrill's user avatar