Questions tagged [encoding]

This challenge relates to data expressed under a different representation or language (including encoding, decoding, and processing such data). Some examples of an encoding includes ASCII and UTF-8.

Filter by
Sorted by
Tagged with
10 votes
12 answers
2k views

Encrypting Emojis

Problem You are tasked with creating a program that performs emoji encryption on a given string of emojis. In this encryption scheme, each emoji is replaced by a unique character (from ...
3.14's user avatar
  • 327
10 votes
3 answers
322 views

Representing a number as an unordered list of smaller numbers

Suppose we want to encode a large integer \$x\$ as a list of words in such a way that the decoder can recover \$x\$ regardless of the order in which the words are received. Using lists of length \$k\$ ...
Karl's user avatar
  • 621
14 votes
7 answers
1k views

Gödel encoding - Part II (decoding)

Part I Previous part was considered encoding of non-empty nested lists with a positive integer. Reminding the coding procedure \$G(x)\$: If \$x\$ is a number, \$G(x) = 2^x\$ If \$x\$ is a list \$[n_0,...
lesobrod's user avatar
  • 3,239
31 votes
18 answers
3k views

Gödel encoding - Part I

Related but different. Part II Taken from the book: Marvin Minsky 1967 – Computation: Finite and Infinite Machines, chapter 14. Background As the Gödel proved, it is possible to encode with a unique ...
lesobrod's user avatar
  • 3,239
0 votes
0 answers
129 views

Decoding a non injective bit matrix encoding

The problem Someone has created an encoding format for square bit matrices, however they have found it isn't perfect! One encoding may not decode to exactly one matrix, or it may not even be possible ...
Energize1828's user avatar
-2 votes
1 answer
113 views

Storing the code in unary [closed]

Your goal is to create a program that can store another program … in unary. The main program uses the unary to run the program encoded in it, as if you were just running the encoded program normally. ...
undefned's user avatar
13 votes
25 answers
2k views

Output the length of (the length plus a message) [duplicate]

The task is simple. You're given an arbitrary string message. Return that message prefixed with a number, such that the length of that number plus the message equals the number. In other words, the ...
virchau13's user avatar
  • 499
6 votes
4 answers
332 views

Encoder/Decoder for efficient number storage!

Description Inspired by this question, write a program/function to encode a number and a program (possibly the same as the first) to decode a bitstream in variable-length encoding as follows (taken ...
justhalf's user avatar
  • 2,249
18 votes
9 answers
2k views

ro1000an nu1000era50 en100o501ng

In the hovertext of this xkcd: There's an "encoding" based on replacing runs of roman numerals with their sums. To do this: Find all runs of at least 1 roman numeral (...
emanresu A's user avatar
  • 35.6k
14 votes
12 answers
2k views

Nega-Zeckendorf representation

Background Zeckendorf representation is a numeral system where each digit has the value of Fibonacci numbers (1, 2, 3, 5, 8, 13, ...) and no two consecutive digits can be 1. Nega-Zeckendorf ...
Bubbler's user avatar
  • 73.8k
9 votes
8 answers
815 views

Encode a Lenguage

The Len(language,encoding) family of languages is a variety of Lenguage derivatives. To encode a program into a Len language, you replace every character with its representation in a certain encoding, ...
emanresu A's user avatar
  • 35.6k
18 votes
14 answers
1k views

Encode USB packets (part 2)

Inspired by this video by Ben Eater. This challenge forms a pair with Decode USB packets. The USB 2.0 protocol uses, at a low level, a line code called non-return-to-zero encoding (specifically, a ...
pxeger's user avatar
  • 23.3k
32 votes
19 answers
3k views

Decode USB packets

Inspired by this video by Ben Eater. This challenge forms a pair with Encode USB packets. The USB 2.0 protocol uses, at a low level, a line code called non-return-to-zero encoding (specifically, a ...
pxeger's user avatar
  • 23.3k
6 votes
0 answers
247 views

Build a program that outputs itself encoded as a QR [closed]

The goal is simple. Write a program that outputs itself encoded as a QR code. A QR code is a way to encode data in a black and white image, similar to a 2D image. An example implementation can be ...
Ari's user avatar
  • 201
17 votes
14 answers
1k views

Implement swap encoding

Swap encoding is an encoding method where you iterate through a string, reversing sections of it between pairs of identical characters. The basic algorithm For each character in the string: Check: ...
emanresu A's user avatar
  • 35.6k
25 votes
27 answers
1k views

Decode Polybus Square/Tap Code/Prison Code

The code has a lot of names, but is very simple: 1 2 3 4 5 1 A B C D E 2 F G H I J 3 L M N O P 4 Q R S T U 5 V W X Y Z A letter is coded by its coordinates, ...
Samuel Waller's user avatar
10 votes
11 answers
1k views

Elias omega coding: decoding

Related: Elias omega coding: encoding Background Elias omega coding is a universal code which can encode positive integers of any size into a stream of bits. Given a stream of bits \$S\$, the decoding ...
Bubbler's user avatar
  • 73.8k
23 votes
29 answers
2k views

Elias omega coding: encoding

Background Elias omega coding is a universal code which can encode positive integers of any size into a stream of bits. Given a positive integer \$N\$, the encoding algorithm is as follows: Start ...
Bubbler's user avatar
  • 73.8k
36 votes
12 answers
3k views

Store eight bits on a punched card

A little while back, data was frequently stored on punched card. A typical card would have 80 columns of 12 possible 'punch' positions. A plethora of encodings was used, each for their own specific ...
Sanchises's user avatar
  • 9,446
8 votes
6 answers
436 views

Japanese Encoding Conversion

Background In JIS X 0208 a 94 by 94 map (kuten (区点)) is defined to encode Chinese characters (kanji), phonetic moras (kana) and other symbols. Along with this standard there are 3 different encodings ...
Shieru Asakoto's user avatar
1 vote
1 answer
266 views

Find all possible dates [closed]

You get a string which contains an integer between 1000 and 99999999 as input. The input string might contain leading zeroes but ...
arminb's user avatar
  • 793
-1 votes
11 answers
547 views

Decode an URL string

Challenge I think everyone of us heard of URL encoding mechanism - it's basically everywhere. Given an URLEncoded string on stdin, decode it, and output the decoded form to stdout. The encoding is ...
Kamila Szewczyk's user avatar
8 votes
11 answers
616 views

Mis-decode a date

Background Inspired by a now deleted question by John Burger from which I quote: Now obviously no human made this mistake. It's a mis-decode of something - perhaps the ISBN? My question is: ...
Adám's user avatar
  • 29.9k
17 votes
19 answers
2k views

Clock (transliterate) Cipher

Introduction: I have loads of different ciphers stored in a document I once compiled as a kid, I picked a few of the ones I thought were best suitable for challenges (not too trivial, and not too ...
Kevin Cruijssen's user avatar
19 votes
13 answers
2k views

Trifid Cipher (without keyword)

Introduction: I have loads of different ciphers stored in a document I once compiled as a kid, I picked a few of the ones I thought were best suitable for challenges (not too trivial, and not too hard)...
Kevin Cruijssen's user avatar
16 votes
14 answers
2k views

Computer Cipher

Introduction: I have loads of different ciphers stored in a document I once compiled as a kid, I picked a few of the ones I thought were best suitable for challenges (not too trivial, and not too hard)...
Kevin Cruijssen's user avatar
17 votes
19 answers
4k views

Decode a 7-segment display

You probably all know the 7-segment display which can display among other things all digits from \$0\dots 9\$: Challenge We only consider the segments \$\texttt{A}\dots\texttt{G}\$, your task is to ...
ბიმო's user avatar
  • 16.7k
23 votes
23 answers
4k views

Encode - Shuffle - Decode

Challenge Your task is to encode an integer as a string of ASCII characters, then successfully decode it after said string has been randomly shuffled. You will write two programs/functions, which ...
Delfad0r's user avatar
  • 6,236
8 votes
5 answers
884 views

Permutation Encoding

Write a program which can encode text to avoid reusing characters, and convert back. Both normal and encoded forms are restricted to a particular character set: the space character ...
EPICI's user avatar
  • 409
6 votes
1 answer
134 views

Bijection: tree-like lists - natural numbers [duplicate]

We define a tree-like list, or trist for short, as the empty list or a list containing only previously constructed trists. The natural numbers can either include 0 or not, according to your ...
ngn's user avatar
  • 15.2k
25 votes
12 answers
3k views

Bake me some moji

Given a string, character list, byte stream, sequence… which is both valid UTF-8 and valid Windows-1252 (most languages will probably want to take a normal UTF-8 string), convert it from (that is, ...
Adám's user avatar
  • 29.9k
50 votes
12 answers
9k views

Professor at MIT can read minds!

The task is taken from an MIT lecture by Prof. Devadas called You can read minds. A detailed explanation of the trick can be found in the linked video, or in this document. I'll try to explain it in ...
Stewie Griffin's user avatar
16 votes
10 answers
2k views

Prime Factor Encoding

How the encoding works Given a list of bits: Hold a prime (starting with 2) Have a list For each bit in the input If it's the same as the previous bit, add the ...
Asone Tuhid's user avatar
  • 2,343
8 votes
3 answers
595 views

Compress to Impress

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
15 votes
11 answers
1k views

Balanced Zero-One Encoding

Task Encode a string that entirely consists of uppercase alphabets (A-Z) using only zeros and ones, using your own favorite scheme. But the rule isn't that simple! ...
Bubbler's user avatar
  • 73.8k
36 votes
18 answers
3k views

Bracket Expansion!

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
  • 13.8k
5 votes
1 answer
816 views

Decode my I2C Stream!

From the sandbox! I2c or TWI, is a 2 way stream that uses 2 signal lines: SDA and SCK. This is used in sensors to communicate ...
tuskiomi's user avatar
  • 3,831
10 votes
1 answer
611 views

Braincopterify an image

Introduction Braincopter is an esoteric Brainf*** derivative that encodes a Brainf*** program as an image. As a 2D language, it uses two additional commands; they rotate the instruction pointer (...
Copper's user avatar
  • 3,900
33 votes
6 answers
3k views

Telegraphy Golf: Decode Baudot Code

Background In 1870 Émile Baudot invented Baudot Code, a fixed-length character encoding for telegraphy. He designed the code to be entered from a manual keyboard with just five keys; two operated with ...
Jordan's user avatar
  • 9,726
8 votes
1 answer
370 views

Double run-length encoding

Everyone knows what run-length encoding is. It has been the subject of many code-golf challenges already. We'll be looking at a certain variation. Example ...
ericw31415's user avatar
  • 2,284
8 votes
4 answers
1k views

Implement an encoder for RFC 1924 IPv6 Addresses

Introduction Everyone should know IPv6 by now. IPv6 has very long, cumbersome addresses. In 1996 some very intelligent people created a scheme to encode them much better in RFC 1924. For reasons I ...
Josef's user avatar
  • 183
13 votes
7 answers
1k views

Code the Huffman!

Or else he will huff and puff and blow your house down! That was completely irrelevant. This challenge is actually about Huffman coding. The gist of it is the frequency of characters in a given text ...
El'endia Starman's user avatar
34 votes
16 answers
2k views

Have you learned your fib-abc?

I don't like numbers, but I do like the Fibonacci sequence. I'm sure we could work something out. Please read one integer n from STDIN and output the nth Fibonacci number in base 26 (...
Filip Haglund's user avatar
3 votes
0 answers
189 views

Dynamic Encoding: A CIA Mission [closed]

The Challenge Mission You are Jim, a CIA agent in charge of super secret spies around the world. However, your enemies, the Naissurs, are highly trained in computer intelligence, and they can hack ...
Meow Mix's user avatar
  • 913
15 votes
4 answers
703 views

Implement bzip2's run-length encoding

Background After applying the BWT (as seen in Burrows, Wheeler and Back) and the MTF (as seen in Move to the printable ASCII front), the bzip2 compressor applies a rather unique form of run-length ...
Dennis's user avatar
  • 210k
21 votes
10 answers
897 views

Move to the printable ASCII front

Background The move-to-front transform (MTF) is a data encoding algorithm designed to improve the performance of entropy encoding techniques. In the bzip2 compression algorithm, it is applied after ...
Dennis's user avatar
  • 210k
21 votes
7 answers
3k views

Confuse the Dakotas [closed]

You have been hired by the government of North Dakota to encrypt the state's communications. Write two programs, one to encrypt a message and one to decrypt that message. The government is not really ...
Ypnypn's user avatar
  • 10.8k
6 votes
4 answers
755 views

Underground geek rock band names

We have a group of stealthy computer-savvy geeks who are also musicians with a very subversive element to their songs that the authorities in their totalitarian country just can't stand, and are ...
Monty Wild's user avatar
12 votes
4 answers
1k views

Encode a string for aliens that read and write English, but don't know ASCII

Turns out there are some distant aliens who know English (and have coincidentally standardized on 8-bit computer architectures). Yet they have never heard of ASCII, nor even alphabetical order. It ...
HostileFork says dont trust SE's user avatar
13 votes
13 answers
4k views

Convert a bytes array to base64

Your mission is to write a function/program that converts an array of bytes (i.e: an array of integers from 0 to 255), to base64. Using built-in base64 encoders is not allowed. The required base64 ...
xem's user avatar
  • 5,831