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

0
votes
0answers
12 views

Convert to and from the backwards-factorial number base

I wanted to ask this question: Convert to and from the factorial number system but I'm a couple of years too late! So, instead you must convert to and from the lairotcaf backwards-factorial number ...
5
votes
0answers
41 views

Same-color arithmetic progressions

Van der Waerden's theorem says that For any given positive integers r and k, there is some number N such that if the integers {1, 2, ..., N} are colored, each with one of r different colors, ...
11
votes
1answer
70 views

Maximise the squared difference

Consider a permutation of the integer values from 1 to N. E.g. this example for N = 4: [1, 3, 4, 2] We'll consider this list to be cyclic, such that 1 and 2 are treated as adjacent. One quantity we ...
12
votes
2answers
114 views

Where does the spaceship go?

Based on an idea suggested by Zgarb. A spaceship is moving around a regular 3D grid. The cells of the grid are indexed with integers in a right-handed coordinate system, xyz. The spaceship starts at ...
27
votes
9answers
1k views

Sort these James Bond ratings

Introduction My grandpa is a fan of James Bond, but he is always unsure on how to rank his favourite actors. As such, he is always making lists, which is a lot of work. He asked me to produce a ...
0
votes
0answers
96 views

clickerhero mercenaries

Introduction I have recently started playing clickerheroes again. In the recent patch they introduced a new mechanic to mercenaries: their lifetime. Instead of having a random chance at dieing now ...
20
votes
7answers
549 views

Substitute numbers by their respective letter

Create a function or program that takes a number as input, and outputs a string where ASCII-code points for the lower and upper case alphabet are substituted by their character equivalents. The ...
0
votes
0answers
57 views

Find maximum frequency [on hold]

I have been given 2D matrix of size NxM. They are filled with values in range from 1 to 10^6. I need to find out maximum frequency of elements taking any row and column at a time. Constraints ...
11
votes
2answers
184 views

Arbitrary Precision Integer Division

We will be implementing division for arbitrarily large integers. This is code-golf. The task is to write a program or function that implements arbitrary precision integers and Division on them. ...
22
votes
3answers
468 views

Sort these bond ratings

The task The credit rating agencies assign ratings to bonds according to the credit-worthiness of the issuer, and the "Big Three" credit rating agencies use a similar (though not identical) tiered ...
18
votes
16answers
1k views

To be or not to be

In the fewest bytes possible, determine whether the two values given each match one of the following: First value 2 string or integer - whichever you prefer to case insensitive too case ...
2
votes
3answers
188 views

Write a radix sort

Goal As the title suggests, write a radix sort function (either MSB or LSB is fine) that accepts two parameters: an array of values of any type (you can assume that they are all of the same type / ...
15
votes
1answer
207 views

A small language deserves a small interpreter

Here is a very simple language definition: A Variable is any string that does not contain ^, <, >, !, or ? The empty string is a valid variable identifier The value of every variable starts at ...
12
votes
10answers
1k views

Convert English to a number without built-ins or libraries

This challenge is similar to this other, however I made a restriction (see bold text below) that I think would made it much diffent and (I hope) fun either. The Challenge Write a program or a ...
5
votes
3answers
261 views

Golf Me a Random Dubstep of the Day List

Aside of nursing my child, Vitsy, and dabbling in the art of code golf, I also am an avid dubstep fan, listening to all the new dubstep that Monstercat puts out as regularly as I can. I also share a ...
11
votes
2answers
219 views

Let's play some boardgame!

Introduction Boardgames are a classic play between kids, but there are some kids that feel bored playing a boardgame step by step. Now they want the result to be shown before they put their hands on ...
12
votes
6answers
775 views

Number of steps for a binary search

Given an input of a positive integer, output the number of steps it takes to find the input via a binary search starting at 1. We are simulating a binary search for the integer that was given as ...
5
votes
3answers
135 views

Inverse Champernowne Substrings

The Champernowne Constant is the irrational number 0.1234567891011... extending ad infinum. We've done a question about it before. But this question is about its reciprocal, known as the Inverse ...
12
votes
3answers
304 views

Challenge about advacado

Inspired by this. No avocados were harmed in the making of this challenge. Hello I have challenge I need help juic an avocado so I need program to tell me how long to juic avocad for Observe this ...
3
votes
2answers
67 views

Tips for Golfing in Vitsy

While there are only a few users of the Vitsy programming language right now, I wish to create a place for tips for golfing in Vitsy. What general tips do you have for golfing in Vitsy? I'm looking ...
11
votes
4answers
163 views

Help recalculate your rep!

A couple months ago, we had a discussion on meta about increasing the reputation awarded for upvotes on questions. Here's the basics of our current reputation system for votes:1 A question upvote U ...
7
votes
0answers
58 views

Tips for golfing in Retina

What general tips do you have for golfing in Retina? I'm looking for ideas that can be applied to code golf problems in general that are at least somewhat specific to Retina (e.g. "remove comments" is ...
30
votes
27answers
2k views

Hollow out an array

The task This challenge is very simple. Your input is a rectangular 2D array of integers, sized at least 1×1. It can be taken in any reasonable format. Your output shall be the input array, but ...
13
votes
3answers
206 views

Illustrate football team formations on a pitch

Football is the sport where players kick the ball, not carry it. Some confused individuals might call this soccer. A football team has one goalkeeper, and 10 players out on the pitch. There are ...
12
votes
12answers
998 views

Preparing a multiple choice test

Introduction Note: this is not some kind of method to encourage cheating. As Cᴏɴᴏʀ O'Bʀɪᴇɴ already said, studying is the best solution for passing a test :3. Consider the following answers to the ...
13
votes
7answers
629 views

Recursive 2x2 determinant

The determinant of a 2 by 2 matrix a b c d is given by ad - bc. Given a matrix of digits with dimensions 2n by 2n, n ≥ 1, output the result obtained by recursively computing the determinant of ...
24
votes
25answers
1k views

Output the van der Corput sequence

The van der Corput sequence is one of the simplest example of low-discrepancy sequence. Its n-th term is just 0.(n written in base 10 and mirrored), so its first terms are : 0.1, 0.2,0.3,0.4, ...
27
votes
18answers
3k views

Sort by Multiplying

You should write a program or function that given a list of positive integers multiplies each element with the smallest positive integer possible to create a strictly increasing list. For example if ...
2
votes
0answers
52 views

Cyclic prime number program generator

Challenge Your submission should consist of 2 or more programs each written in distinct languages. They can be arbitrarily numbered from 1 to k. Each program p, given a natural number n should ...
-1
votes
1answer
120 views

Find the square root, BUT [on hold]

Write a square root function that takes an input, positive or negative, and calculate it's square root, correct up to six decimal places (then truncate after the sixth decimal place). But, you cannot ...
24
votes
29answers
2k views

Determine the depth of an array

A simple challenge for your Monday evening (well, or Tuesday morning in the other half of the world...) You're given as input a nested, potentially ragged array of positive integers: [1, [[2, 3, ...
9
votes
3answers
209 views

Verify the birth number

A Norwegian Birth Number consists of 11 digits, composed the following way: DDMMYYiiikk DD is the day (from 01-31) MM is the month (from 01-12) YY is the year (from 00-99). It's not differentiated ...
4
votes
1answer
86 views

Write a Semiquine

Suppose you have 2 languages, A and B. A string s is a semiquine in A and B if it satisfies the following conditions: s is a quine in language A. s is a polyglot in A and B. The output of running s ...
0
votes
2answers
137 views

Print cos(2π/17) exactly

One way to construct a regular heptadecagon starts with drawing a horizontal line of length 1 from the center to a vertex. Then the distance along that line from the center to the second vertex is ...
14
votes
1answer
232 views

Implement the Enigma Machine

The Enigma machine is a fairly complex cipher machine used by the Germans and others to encrypt their messages. It is your job to implement this machine*. Step 1, Rotation Our enigma machine has ...
15
votes
9answers
518 views

Align function arguments on their own lines

Given an input of a string representing a function definition, output the string with newlines and spaces inserted so that the function's arguments are newline-separated and aligned. The input string ...
13
votes
18answers
978 views

Decimal Multiplication of Strings

Given 2 inputs, a string and a decimal number, output the string multiplied by that number. The catch is that the number can be a float or an integer. You should output the string floor(n) time and ...
17
votes
17answers
3k views

The Lucas-nacci Numbers

Background Most everyone is familiar with the Fibonacci numbers F(n): 0, 1, 1, 2, 3, 5, 8, 13, 21 ... These are formed by the recursion function F(n) = F(n-1) + F(n-2) with F(0)=0 and F(1)=1. ...
7
votes
1answer
81 views

Program touch-tone instructions for my fingers

The keypad on my office phone has the following layout: [1] [2] [3] /.@ ABC DEF [4] [5] [6] GHI JKL MNO [7] [8] [9] PQRS TUV WXYZ [*] [0] [#] + _ Task: Write a program that, ...
1
vote
1answer
60 views

“Fouriest” Transform of An Integer [duplicate]

Challenge Inspired by this SMBC comic, discussed on reddit, math.stackexchange, and calculus7, the challenge is to return the lowest base such that a number is "fouriest." Description [From the ...
18
votes
13answers
2k views

Molding ASCII art

You are given a single printable ASCII string containing no newlines, and a multiline "mold", containing spaces (), and hashes (#). You must go character by character in the string, and replace ...
17
votes
7answers
2k views

Who's gonna win the football game?

The American football championship, Super Bowl 50, is happening today at 11:30pm UTC (and you can watch it live online). This challenge was made to celebrate it. In an American football game, two ...
29
votes
3answers
3k views

Dank Meme Generator

I like making dank memes out of my own images. But all those so called "quick meme" sites just have too much code. I realized that the only way to make the dankest meme generator is to ask you guys at ...
-3
votes
0answers
71 views

Let's make some noise [on hold]

Create a program, wich generates and prints out a pseudo random gradient noise, like perlin or simplex noise. Rules You need to take in the size of the noise with stdin (if your language doesn't ...
11
votes
15answers
2k views

Apply Kirchhoff's law

Kirchhoff's law says that when you sum up all the currents (positive for the currents going to a junction, and negative for current leaving a junction), you will always get as result 0. Look at the ...
22
votes
25answers
2k views

Difference of three input integers

Implement a function diff that takes as input three integers x, y, and z. It should return whether subtracting one of these numbers from another gives the third. Test cases: diff(5, 3, 2) yields True ...
23
votes
8answers
1k views

Approximate ∫((e^x)/(x^x))dx

You are to approximate the value of: Where your input is I. Rules You may not use any built-in integral functions. You may not use any built-in infinite summation functions. Your code must ...
8
votes
1answer
166 views

Print sin, cos, and tan of special angles

In trigonometry, there are certain angles known as "special angles". This is because when you take sin, cos or tan of one of these angles, you get a result that is easy to remember because it is a ...
11
votes
8answers
675 views

Eat the Chocolate Bar

I have a chocolate bar and I need help eating it so you'll be writing a program just to do that. Explanation The first line is the input. Examples are separated by an empty line. 7 ____ __|__| ...
0
votes
0answers
76 views

Convert string to time

This challenge is inspired by this other. The challenge Write a program or a function in any programming language that given as input a string representing a time in English (see below, for further ...