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

8
votes
4answers
201 views

Convert English to a number (but all by your own)

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 ...
2
votes
0answers
92 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 ...
9
votes
2answers
152 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 ...
11
votes
6answers
675 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 ...
2
votes
2answers
92 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 ...
11
votes
2answers
203 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
47 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
128 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 ...
6
votes
0answers
49 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 ...
27
votes
26answers
1k 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
162 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
937 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
618 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 ...
21
votes
20answers
902 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, ...
24
votes
17answers
2k 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
48 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
116 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 ...
22
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, ...
8
votes
3answers
179 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
82 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
132 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
177 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
516 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
968 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
2k 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
79 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 ...
17
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
1k 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
163 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
671 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
75 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 ...
20
votes
14answers
1k views

Inverse function

Wouldn't it be neat if programming functions could be inverted, just like the mathematical function they implement? Write a function (or program) that takes one input x in any form, that outputs ...
10
votes
4answers
259 views

Efficient Scientific Notation

The other day my chemistry teacher was explaining to us about scientific notation (using a small number and multiplying it by powers of ten to express large numbers more easily), which brought me back ...
6
votes
1answer
116 views

Implement almost-equals for IEEE numbers

Isn't it annoying when you're working with floating point numbers and your code doesn't work because two numbers are not equal by the least significant bit? Now you can fix that! Write some code that ...
17
votes
15answers
489 views

Find the nth cross-alternate sum

Given an input of a single positive integer, output the "cross-alternate sum" that corresponds to that integer. Take the example of the input n=5. To find the cross-alternate sum, first create a ...
13
votes
5answers
402 views

Find the coastline

Your task is to find the length of the coastline of a map of islands provided in an ASCII map. The input map will consist of 1 or more # characters that indicate land, and spaces which indicate water. ...
12
votes
1answer
235 views

Fibonacci's numbers … not those!

Leonardo da Pisano a.k.a Fibonacci was instrumental in bringing the Hindu-Arabic numeral system into Europe. Before that, mathematicians there worked in base sixty with Roman numerals. For example, ...
15
votes
6answers
302 views

Convert the Time to a String

Problem One day, you boss walks up to you and tells you he needs to know the time. He still insists after you pointing at the clock directly above you head, and confesses he has a severe case of ...
25
votes
31answers
2k views

Find the largest and the smallest number in an array

The Task The task is very simple. Given an array containing only integers and strings, output the largest number and the smallest number. Test Cases Input: [1, 2, 3, 4, 5, 6, 7, 8] Output: 1, 8 ...
12
votes
4answers
305 views

All the numbers that fit in a string

Write a program or function that takes in a positive integer N. Output a list of all the distinct decimal numbers that can be written in exactly N characters using digits (0123456789), decimal points ...
21
votes
4answers
273 views

Magnetic pull in an array

Background I have a row of powerful magnets and a bunch of metal objects between them. Where will the magnets pull them? Input Your input is an array of non-negative integers, which will contain at ...
23
votes
13answers
1k views

Fibonacci-style matrix expansion

For each row and then column of a matrix, we can add an extra entry with the sum of the last two entries in that row or column. For example with the following input matrix: [ 1 1 1 ] [ 2 3 4 ] The ...
1
vote
0answers
167 views

Shortest code to cycle through RGB LEDs [closed]

Given four RGB LEDs and 8 colors, your task is to light up each LED in order with a color, and cycle through the LEDs as you cycle through the colors; with only one LED lit up at a time. So for 8 ...
19
votes
25answers
3k views

Build a chessboard

Saw this in a PHP challenge. The objective is to make a chessboard with 64 squares (8*8) with the minimum amount of code. Simple enough, I made mine in PHP in 356 bytes (not impressive, I know) and I ...