Code-golf is a competition to solve a particular problem in the fewest bytes of source code. If you want to score by characters instead of bytes, state this explicitly in the challenge. If source code length is not the primary scoring criterion, consider using another tag instead.

learn more… | top users | synonyms

4
votes
4answers
220 views

Golf me an HQ9+ Compiler

Your task is "simple" should you choose to accept it. Write an HQ9+ compiler in a language of your choice. Your submission should be written in some language X, and should take input of HQ9+ source ...
10
votes
11answers
234 views

Calculate the partitions of N

Your challenge is simple: GIven an integer N, ouput every list of positive integers that sums to N. For example, if the input was 5, you should output [1, 1, 1, 1, 1] [1, 1, 1, 2] [1, 1, 3] [1, 2, 2]...
6
votes
0answers
59 views

Convert an Expression to Panfix Notation

I was browsing esolangs, and chanced upon this language: https://github.com/catseye/Quylthulg. One interesting thing about this language, is that it doesn't use prefix, postfix, or infix, it uses all ...
17
votes
16answers
685 views

Reverse and subtract

Challenge description Let's take a positive integer n, reverse its digits to get rev(n) and get the absolute value of the difference of these two numbers: |n - rev(n)| (or abs(n - rev(n))). Example: ...
12
votes
1answer
2k views

Prove me wrong!

Introduction Your mission in life is simple: Prove people wrong on the internet! To do this you usually carefully analyze their statements and point out the contradiction in them. It's time to ...
28
votes
14answers
4k views

Can Pac-Man Eat This String?

In the arcade version of the game, Pac-Man eats pac-dots. However, in this challenge, he's hungry for alphanumeric characters and punctuation in a string. Your task is to create a function that feeds ...
12
votes
16answers
710 views

Calculate the sum of ILD

Input: An integer Output: Sum of the input itself + the length of the input + each individual digit of the item. nr + nr-length + {sum of individual digits} = output For example: Input: 99 ...
4
votes
1answer
192 views

Starbucks to English

In the classic days of Starbucks before these newfangled sticker-printers and wireless drivethrough headset palmtop scanner dealies, in the heady days of 2000-ish, Starbucks' had a concise system for ...
1
vote
7answers
182 views

From Rgb to Cmyk [on hold]

input 3 bytes (red, green and blue values of a color), calculate the nearest cmyk values, and output them. make a function with parameters and return value or a program that operates on stdin/stdout ...
28
votes
25answers
4k views

Print a Lego Piece

This challenge is a simple ascii-art one. Given two inputs, describing the height and width of a Lego piece, you have print an ascii-art representation of it. Here is how the Lego pieces are supposed ...
9
votes
10answers
701 views

Choose from an existing set of weights to make a target sum

When doing weightlifting, I want to make a specific weight by attaching several plates to a bar. I have the following plates: 6 plates of 1 kg each 6 plates of 2.5 kg each 6 plates of 5 kg each 6 ...
11
votes
19answers
2k views

Golf bit weaving

Note: the first half of this challenge comes from Martin Ender's previous challenge, Visualize Bit Weaving. The esoteric programming language evil has an interesting operation on byte values which it ...
-1
votes
1answer
164 views

Write a AZERTY to QWERTY converter [duplicate]

Your task is to create a program will transform each letter of a text typed on a AZERTY keyboard to the equivalent on a QWERTY keyboard, using the same keystrokes. Example: Hello; Zorld1 => Hello, ...
4
votes
11answers
718 views

Recursion bracketed; or Dyck words generation

We already have challenges to check if a string of brackets is fully matched and to count the number of balanced strings. It remains for us to generate these strings, but it will not be so easy… A ...
44
votes
14answers
4k views

Knight on the Rim is Grim

Introduction Aron Nimzowitsch was a leading chess master and a influential chess writer. In his book 'My System', the first chapter deals about the importance of the center and why you should ...
8
votes
8answers
945 views

Fred's water bill

Fred is a quasi-friendly guy, but in reality he is mean. Because of this, Fred lives alone in a small apartment in Los Altos, CA. Fred is so mean because he is very particular about water. He, ...
12
votes
8answers
314 views

Autonest an array

Everybody loves nested lists! However, sometimes it's hard to make a nested list. You have to decide if you want to nest it deeper, or if you need to nest it shallower. So for your challenge, you must ...
3
votes
0answers
92 views

Decompose the domain

In scientific computing, it is often desirable to decompose some large domain into smaller "subdomains", then parallelize the computation by performing the work on each subdomain in parallel and the ...
3
votes
0answers
180 views

Monitorize an Image [on hold]

The Problem: This challenge comes from a real problem I was having. I have a dual monitor setup at work, and I wanted to use the following image as my wallpaper: However, my monitors have quite ...
26
votes
11answers
3k views

Visualise Bit Weaving

The esoteric programming language evil has an interesting operation on byte values which it calls "weaving". It is essentially a permutation of the eight bits of the byte (it doesn't matter which end ...
31
votes
12answers
5k views

Theoretically output Graham's number

Graham's number G is defined in this way: u(3,n,1) = 3^n u(3,1,m) = 3 u(3,n,m) = u(3,u(3,n-1,m),m-1) [Knuth's up-arrow notation] [Conway chained arrow notation] THEN g1 = u(3,3,4) g2 = u(3,3,g1) g3 ...
26
votes
9answers
2k views

Professor Schwartzman's Acme Canine Decoder 2000

Introduction We -- especially the geeks among us, who tend to be fans -- all remember this old Far Side cartoon: Clearly, Professor Schwartzman could have brushed up on his programming skills just ...
10
votes
5answers
307 views

Evaluate a Stratego Battle

In the game Stratego, the main game mechanic is when you attack an opponent's piece with yours. In this challenge, you job is to simulate one of these battles and say who survives. Specs You will ...
16
votes
26answers
4k views

bfcat - encode a file as a brainf*** program

Challenge Write a program or function that given a string, returns a valid Brainfuck program that when compiled and executed as Brainfuck, returns that string.. Assume all inputs are encoded as ...
7
votes
8answers
284 views

Ninja Assassins - which ninja stays alive? [duplicate]

Ninja Assassins - which ninja stays alive some basic information given an int N as the number of ninjas, return the number of the winning ninja. At the end only 1 ninja survives,the question is ...
22
votes
14answers
2k views

Simplify a square root

Given a positive integer n, simplify the square root √n into the form a√b by extracting all square factors. The outputted a,b should be positive integers with n = a^2 * b with b as small as possible. ...
6
votes
5answers
205 views

Build a marginal tax calculator

There have been some tax rate calculator problems here that depend on defined rates (specifically US federal rates), but none that have done it for arbitrary lists. Your task is to build a program or ...
6
votes
3answers
252 views

Flood-fill a 2D grid

Challenge description Let's call a two-dimentional, rectangular array (meaning its every subarray has the same length), a grid. Every unit of a grid is either an empty space or a border. In a grid of ...
16
votes
8answers
1k views

Falling ASCII balls

Input You are given a 2D map with balls and ground in it. It looks like this: 1 5 2 3 4 __________________________ Each number is a ball, and the _ is ...
22
votes
0answers
189 views

Solve the chromatic puzzle

Over at our friends at [Puzzling.SE], the following puzzle was posted: Is this chromatic puzzle always solvable? by Edgar G. You can play it here. Puzzle explanation Given a m x n grid with tiles of ...
6
votes
4answers
281 views

Time for some TEA!

Introduction A while back I stumbled across the tiny encryption algorithm (TEA) and since then I have recommended it whenever special cryptographic security properties were un-needed and a self-...
-1
votes
0answers
73 views

Golf a Recursion [closed]

Your goal is to make a function, which calls itself. It must be sure that it's recursion, so the function must print something or input. Rules The function (or how it's called in your favorite ...
13
votes
11answers
2k views

I only pay with dollars

As the title -- although discretely -- hints, I only pay with dollars. The challenge Write a function/program that takes a string as input, which is a monetary value preceded by a symbol. ex) £4.99....
-5
votes
0answers
55 views

Convert Decimal to hexadecimal using inbuilt tools [duplicate]

There are no rules. You can use whatever language you want. I just want to know if there is any solution possible less than 10 characters. But all the solutions are welcome. RUBY 10 characters p ...
8
votes
6answers
223 views

Index sum and strip my matrix

Index sum and strip my matrix Given a matrix/2d array in your preferable language Input: The matrix will always have an odd length The matrix will always be perfectly square The matrix values can ...
15
votes
9answers
931 views

Forecast Palindromic Dates

Palindromic dates are dates that appear as palindromes: the string of digits can be read the same way backwards as forwards. For the North American date format (MM/DD/YYYY), the next few palindromic ...
21
votes
22answers
2k views

Bytes/Character

Task Given a UTF-8 string (by any means) answer (by any means) an equivalent list where every element is the number of bytes used to encode the corresponding input character. Examples ! → 1 Ciao → ...
7
votes
20answers
710 views

Character Counting System [duplicate]

GOAL : To Implement a character counting program This is how this counting system works : input of the program is a set of printable ASCII characters . the program counts each type of character , ...
13
votes
5answers
719 views

Play scrabble with the periodic table

You've got a set of tiles with the symbols from the periodic table. Each symbol appears once. You're thinking up words to make but you want to know if it's possible or not. The Challenge Write a ...
48
votes
30answers
4k views

Convert YYYYMM to MMMYY

Basing on this SO question. Challenge is rather simple: given a date period in the format YYYYMM output it in the format MMMYY. Rules: The input will be a number or a string exactly 6 characters ...
5
votes
2answers
390 views

Write a chicken interpreter!

You have to write an interpreter for a cool language called Chicken! You should read a Chicken program from a file, standard input, program or function arguments, or whatever is most convenient for ...
21
votes
27answers
2k views

Calculate Euler's totient function

Background Euler's totient function φ(n) is defined as the number of whole numbers less than or equal to n that are relatively prime to n, that is, the number of possible values of x in 0 < x <=...
9
votes
10answers
319 views

Derivative at the Edge

My preferred way to approximate a derivative is the central difference, its more accurate than forward difference or backward difference, and I'm too lazy to go higher-order. But the central ...
10
votes
3answers
260 views

Ways to get to the number

Given the input of the first number and the second number (both positive integers, zero exluded), determine in how many ways could you make the second out of the first, using following actions: +1,+2 ...
0
votes
1answer
128 views

Tell Me about yourself [closed]

Your task is to write a self referential program similar to a quine. The objective is to write a program that will generally print to stdout twice whatever the input is. But when it receives the input ...
10
votes
2answers
302 views

Prove that a Number is Algebraic

Inspired by this answer (emphasis mine): We will play a game. Suppose you have some number x. You start with x and then you can add, subtract, multiply, or divide by any integer, except zero. You ...
11
votes
1answer
398 views

Chessboard maze

Chess pieces (kings, queens, rooks, bishops, and knights) and pawns are on a board, but not on the a1 or h8 square. Your task is to travel from the empty a1 to the empty h8 squares, passing through ...
8
votes
5answers
395 views

Downward Number Race

Your task is to create a program that adds random numbers to previous sums in the ultimate number racing showdown. Each racer (column) starts at 0 and adds either 1 or 0 to the previous sum at each ...
14
votes
8answers
645 views

Alternating sign matrix verification

An alternating sign matrix is an n by n matrix consisting of the numbers -1, 0, 1, such that: The sum of each row and column is 1 The nonzero entries in each row and column alternate in sign These ...
18
votes
26answers
2k views

Count Up, Replace, Repeat!

Definition Define the nth array of the CURR sequence as follows. Begin with the singleton array A = [n]. For each integer k in A, replace the entry k with k natural numbers, counting up from 1 to k....