Questions tagged [code-golf]

Code-golf is a competition to solve a particular problem in the fewest bytes of source code.

12,036 questions
Filter by
Sorted by
Tagged with
2k views

Compute the degree of a string

The input is a string made of the letters a,b,c only. The output is an integer representing the degree of the sequence. The degree of a sequence is computed as follows: Assume that each of the ...
• 1,993
242 views

Integrate a function from -1 to 1 [closed]

Create a function or program that takes any continuous, well-defined, single-input function (f(x)=...) and returns an approximate integration from -1 to 1. (at ...
923 views

Construct a uInt from an array of bits

Task is simple! Take an array of binary values (can be boolean, 0/1, etc.) and use those bits to construct an n-th bit long unsigned integer (return type does not need to be an unsigned integer, just ...
388 views

Where are zeros? Self-describing sequence

Background A167519: Lexicographically earliest increasing sequence which lists the positions of the zero digits in the sequence. ...
• 77.7k
2k views

Decode Caesar cipher based on a given text

I can't think of a better name. This is similar to this challenge, but a lot easier. Read three strings which contain only uppercase letters. The length of the first and second strings are the same. ...
• 1,115
1k views

Golfing the complexity with subtraction

The Mahler-Popken complexity, $C(N)$, of a positive integer, $N$, is the smallest number of ones ($1$) that can be used to form $N$ in a mathematical expression using only the integer* $1$ ...
• 108k
281 views

How can I reduce the characters in the following python code? [closed]

The following code is 47 characters. print(("Ekki v","V")["COV"in input()]+"eikur!") How can it be reduced to 46 or less? I ...
474 views

How far are you?

Write a program that gets coordinates of two objects on Earth, and calculates how far they are from each other directly in space (a straight line through Earth) and on the surface (through the ...
799 views

*Trivial* near-repdigit perfect powers

Task Output the sequence that precisely consists of the following integers in increasing order: the 2nd and higher powers of 10 ($10^i$ where $i \ge 2$), the squares of powers of 10 times 2 or 3 (...
• 77.7k
3k views

Anti Tic-Tac-Toe

The rule of Anti Tic-Tac-Toe is like Tic-Tac-Toe. The rules are: There is a 3*3 grid, the squares in the grid are labeled 1 to 9: 123 456 789 ...
• 1,115
605 views

Find the rule of a cellular automaton

There are already many challenges where you are given a cellular automaton rule and an initial state and you have to find the state after a certain number of steps. This challenge is the opposite: you ...
• 48.7k
3k views

3 Dimensional Minesweeper

3-Dimensional Minesweeper I've been on a minesweeper kick for a while, but all the questions are for 2 dimensions (or that one in 1D). But 2D is 2 easy! Challenge Write the shortest code possible to ...
• 4,155
1k views

HTML Table Parser

Input a strict subset of HTML <table> string representation as defined below. Output parsed table, while any cells who span multiple rows or columns, record ...
• 35k
694 views

Sith TIE-Fighter

Today is May 5th which means it's Star-Wars Day episode II: Revenge of the 5th. For this task, you will output the following image of a Sith TIE-fighter: ...
• 8,613
1k views

X-Wing Starfighter

Today is May 4th, Star Wars day, so here's a Star Wars ASCII-art task. Output this image of an X-Wing starfighter: ...
• 8,613
1k views

Visually arrange multi-day events on a calendar

The arrangement algorithm I think I've determined the algorithm that Google Calendar uses to visually arrange day-long and longer events at the top of the "Week" view (you may have an ...
• 3,684
980 views

Divisibility patterns

Your inputs are a string and an integer. Your output is the 2d matrix of strings achieved from adding 0 to N spaces between each ...
• 1,053
1k views

Infer pluses and minuses

The problem Consider an equation such as      "3 ± 2 ± 4 ± 1 = 4"      and determine if there exists a sequence of pluses and minuses that makes it arithmetically correct. If it exists, ...
• 3,684
1k views

Enumerate all matches of a regex

related For this challenge, we'll be using a simplified dialect of regular expressions, where: A lowercase letter from a to z ...
• 39.2k
2k views

Interpret PlusOrMinus

PlusOrMinus is an esoteric programming language invented by Esolang user PythonshellDebugwindow. Language specification There is a wrapping byte accumulator (incrementing ...
• 1,115
2k views

• 99.1k