Skip to main content

Questions tagged [code-golf]

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

13 votes
13 answers
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 ...
Erel Segal-Halevi's user avatar
-3 votes
4 answers
241 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 ...
ThePlaneGuy45's user avatar
11 votes
23 answers
922 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 ...
ThePlaneGuy45's user avatar
14 votes
2 answers
387 views

Where are zeros? Self-describing sequence

Background A167519: Lexicographically earliest increasing sequence which lists the positions of the zero digits in the sequence. ...
Bubbler's user avatar
  • 77.5k
11 votes
22 answers
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. ...
None1's user avatar
  • 1,115
16 votes
6 answers
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\$ ...
Jonathan Allan's user avatar
0 votes
1 answer
280 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 ...
LargeHorse's user avatar
8 votes
4 answers
472 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 ...
George Glebov's user avatar
13 votes
11 answers
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 (...
Bubbler's user avatar
  • 77.5k
13 votes
5 answers
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 ...
None1's user avatar
  • 1,115
8 votes
6 answers
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 ...
alephalpha's user avatar
  • 48.7k
14 votes
12 answers
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 ...
pacman256's user avatar
  • 4,155
12 votes
3 answers
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 ...
tsh's user avatar
  • 35k
6 votes
3 answers
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: ...
noodle person's user avatar
6 votes
5 answers
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: ...
noodle person's user avatar

15 30 50 per page