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

5
votes
7answers
366 views

Missing Integer Sequence Detection — Filesystem

The challenge is to detect missing integer sequences of files or directories. You have a directory filled with files/directories that are named as integers. The files/directories are generated from ...
21
votes
20answers
1k views

Output a Magical 8 Trapezium

Your task is to output a Magical 8 Trapezium: 1 × 8 + 1 = 9 12 × 8 + 2 = 98 123 × 8 + 3 = 987 1234 × 8 + 4 = 9876 12345 × 8 + 5 = 98765 123456 × 8 + 6 = 987654 ...
25
votes
10answers
1k views

Array Escape - get out of there

One day you awake only to find yourself caught in an array. You try to just walk out of there, taking one index at the time, but it seems there are other rules: The array is completely filled with ...
27
votes
22answers
2k views

Detriplicate a string

A lot of languages have built-in ways to get rid of duplicates, or "deduplicate" or "uniquify" a list or string. A less common task is to "detriplicate" a string. That is, for every character that ...
12
votes
8answers
524 views

Collect and place items

The goal of this challenge is to collect selected items in a list and move them to a certain location in the list. As a visual example, take the input values (represented by black boxed integers) and ...
17
votes
16answers
973 views

Interquartile Mean

Task Given (by any means) a sorted floating point dataset, return (by any means and within 1‰ of the correct value) the interquartile mean. One possible algorithm Discard the lowest and highest ...
9
votes
6answers
257 views

Reverse Bayer Filter of an image

Almost all digital camera sensors are organized in a grid of photosensors. Each photo sensor is sensitive for one of the primary colors: red, green and blue. The way those photo sensors are organized ...
11
votes
16answers
762 views

Gear Train, Rotating

Gears transfer different amount of speeds, depending on the size of the meshed gear. Jack has a machine, that rotates a Gear Train. but you don't know the speed of the last gear. Luckily, You are ...
5
votes
1answer
107 views

Low pass filter

The goal of this challenge is to implement a digital low-pass filter. You are free to implement any type of digital filter you want, however whatever results produced must pass the validation script ...
-1
votes
0answers
90 views

Write a basic REPL (command interpreter) [on hold]

Challenge Write a REPL (command interpreter). This is similar to a shell, and allows executing commands in scripting languages. The interpreter should interpret the language it is written in. It ...
10
votes
9answers
2k views

Bring ASCII art to the 3rd dimension

In this challenge, You have to bring ASCII art (which are usually 2D) to 3D! How? like this, X X DD X D D X X DD to... X X DD X X DD D X X DDDD X XDDD X X DD Then How do we do that? ...
23
votes
28answers
1k views

Substring Sum Set

Introduction Let's observe this array: [3, 2, 4, 1, 1, 5, 1, 2]. Each element displays the length of the substring which must be summed up. Let's take a look at the first element of the above array: ...
16
votes
2answers
183 views

Given a truth table, output a Stackylogic program that satisfies it

Stackylogic is a programming language I made up in a previous challenge: Run Stackylogic. Read that post for full details and examples, but here is how it works paraphrased: Stackylogic takes 0's ...
8
votes
3answers
421 views

Draw the EU Estimated Sign

The specification of the "estimated" sign used by the European Union Directive (U+212e in Unicode, which you may not simply print for this challenge) is quite precise. To copy some restrictions ...
14
votes
64answers
2k views

Divisibility test

Task Given two strictly positive integers n and d as input, determine whether n is evenly divisible by d, i.e., if there exists an integer q such that n = qd. You may write a program or a function ...
19
votes
95answers
5k views

Print Numbers from 1 to 10 [duplicate]

This might be a very simple challenge, but I am surprised it hasn't been done on code-golf yet: Print all Integers from 1 to 10 inclusive in ascending order to the Standard Output Your output format ...
13
votes
15answers
3k views

How to weight loss easily?

In this question, we will only focus on losing weight by doing exercise, although there are still many ways to lose weight. Different sports burn different amount of calories. For example, playing ...
5
votes
4answers
258 views

Semi-decide Post's Correspondence Problem

The Post's Correspondence Problem (PCP) gives you a list of pairs of strings, P_1 ... P_n. Your task is to find a k, and some sequence of k indices such that fst(P_i1) ... fst(P_ik) = snd(P_i1) ... ...
48
votes
45answers
7k views
+100

Count of “a”s and “b”s must be equal. Did you get it computer?

In the popular (and essential) computer science book, An Introduction to Formal Languages and Automata by Peter Linz, the following formal language is frequently stated: mainly because this ...
5
votes
4answers
275 views

Validating a CPR number

Validating a CPR number A Danish CPR number (Person Identification Number) is date of birth followed by 4 digits (the last one being a control digit): DDMMYY-XXXX The final digit validates the CPR ...
29
votes
12answers
2k views

Generate Pascal's Braid

This is Pascal's Braid: 1 4 15 56 209 780 2911 10864 40545 151316 564719 1 3 11 41 153 571 2131 7953 29681 110771 413403 1542841 1 4 15 56 ...
-4
votes
1answer
176 views

Send me an E-mail without the letter e [closed]

The challenge is simple, send me an email with the text ("I'm " + [username] + ", and I did it!") without using the letter 'e' in your source code. If your username has an e, you're allowed to filter ...
21
votes
15answers
3k views

Draw a ladder and slide

Your task is to create a program or function that takes, as input, a natural number (n) between 1 and 25 (inclusive) and prints an isometric representation of a slide and ladder with n number of rungs....
13
votes
12answers
517 views

Inverting lists of lists of indices

Inspired by this StackOverflow post. Introduction Bob's job is to create spreadsheets and organize them. The way he organizes them is known to very few except for Bob, but he creates a list of each ...
17
votes
10answers
1k views

What exactly was your question?

Introduction When you are given a boring text, you just want to get it over with as quick as possible. Let's observe the following text: Ens colligi timenda etc priorem judicem. De quascunque ii at ...
23
votes
24answers
3k views

Calculate the Super-Logarithm

This should be a simple challenge. Given a number n >= 0, output the super-logarithm (or the log*, log-star, or iterated logarithm, which are equivalent since n is never negative for this ...
22
votes
23answers
2k views

Ordering a list

Summary Given a list of integers, return the index each integer would end up at when sorted. For example, if the list was [0,8,-1,5,8], you should return [1,3,0,2,4]. Note that the two 8s maintain ...
19
votes
17answers
5k views

Dijkstra's Challenge

Presented in honor of APL as an interactive tool turning 50 this year Background Ken [Iverson] presented his paper Formalism in Programming Languages in August 1963 at a Working Conference on ...
41
votes
24answers
4k views

Polar Bear, Polar Bear, what do you hear?

The text of the children's book Polar Bear, Polar Bear, What Do You Hear? has a very simple pattern. You might use the text to teach introductory programming concepts. My son was quickly bored by ...
23
votes
22answers
2k views

Which ghosts are missing?

In this challenge, given a list of ghosts from Pac-Man, you must output which ghosts are missing. You must do it in as few bytes as you can Input Input will consist of a string or list, which will ...
9
votes
6answers
194 views

Binary Recurrence Sequences

A binary recurrence sequence is a recursively-defined sequence of the following form: This is a generalization of the Fibonacci (x = 1, y = 2, a = [1, 1], alpha = 1, beta = 1) sequence and the ...
14
votes
5answers
391 views

Visualize a Difference Pyramid

A difference pyramid is a pyramid where each new diagonal is the absolute value of the differences between the elements of the last diagonal. For example, if we start with the array 2 5 4 9 3 4 Now,...
18
votes
8answers
1k views

Generate the Rummy Sequence

Your task is to take an input n and output element n of the Rummy Sequence, a sequence which I made (looking on OEIS will not help you). Definition Each element of the Rummy Sequence is a set of ...
2
votes
0answers
57 views

Listing all closed cycles in a list [duplicate]

I'm new here. I tried seeing if this challenge was introduced before. Found a close call one counting the number of cycles, but didn;t find one for listing them. So I'm writing this one. Sorry if I'm ...
30
votes
70answers
3k views

Print all alphanumeric characters plus underscore

Write a program or function that prints or returns a string of the alphanumeric characters plus underscore, in any order. To be precise, the following characters need to be output, and no more: ...
14
votes
20answers
789 views

Select the word around the given index in a given string

In Windows, when you perform double-click in a text, the word around your cursor in the text will be selected. (This feature has more complicated properties, but they will not be required to be ...
21
votes
24answers
3k views

#Hashtag_or_not

In this code golf, You will verify Hashtags! #What_your_code_should_do Input a string. output truthy value if it is a valid hashtag, and falsy value if not. We define a string as a valid Hashtag if....
-1
votes
0answers
73 views

Easy Calculation [duplicate]

Challenge User enters a string in the form "2PLUS3" and we get output "5" Sample Input 2PLUS3MULTIPLY3DIVIDE3 Output 5 Rules Final result must follow the precedence order of operation. ...
14
votes
8answers
837 views

Find numbers within the Copeland–Erdős constant

Background The Copeland–Erdős constant is the concatenation of "0." with the base 10 representations of the prime numbers in order. Its value is 0.23571113171923293137414... See also OEIS A033308. ...
33
votes
26answers
8k views

Fibonacci reversed!

Introduction We all know and love our Fibonacci sequence and have seen a myriad of challenge on it here already. However, we're still lacking a very simple case which this answer is going to provide: ...
18
votes
6answers
490 views

Recognize mod-folds

Task Define a mod-fold as a function of the form f(x) = x % a1 % a2 % … % ak, where the ai are positive integers and k ≥ 0. (Here, % is the ...
8
votes
7answers
320 views

Write a program to display directory treehouse

Given a directory (such as C:/), given from stdin or read from a file, produce a directory tree, with each file/folder indented based on its depth. Example If I have a C:/ drive which only contains ...
26
votes
15answers
1k views

Remove duplicated & switched case

Goal The goal of this challenge is: given a string as input, remove duplicate pairs of letters, if the second item in the pair is of opposite capitalization. (i.e. uppercase becomes lowercase and ...
21
votes
7answers
843 views

I programming puzzles, il code golf

Background The Italian definite article (corresponding to English the) has seven different forms: l', il, lo, gli, i, la, le. Which one to use depends on three variables: Gender: masculine / ...
17
votes
13answers
447 views

Directory calculation

For this challenge, you will be given an absolute path, and a "new" path (which can be absolute or relative), and you need to return the final path. For example, if your current directory was /var/...
29
votes
13answers
2k views

Stock Time Machine

Stock Time Machine You've gained access to a dataset, tomorrowStocks, which contains the stock prices from your favorite business on the NASDAQ. This dataset is a container indexed by minutes past ...
26
votes
20answers
3k views

Calculate A190810

Your task is pretty simple, calculate the n-th element of A190810. Elements of A190810 are calculated according to these rules: The first element is 1 The sequence is increasing If x occurs in the ...
6
votes
6answers
779 views

Is case sensitivity important? Part II: reality check

In this question Tom learned that, in general, there are many motivations to choose to include case sensitivity in his programming language, because the possible combinations for a variable name are ...
11
votes
5answers
566 views

Runs of Digits in Pi

Your goal is to output the strictly increasing sequence of consecutive, identical digits of pi (π). Each term in the sequence must be one digit longer than the previous. So 3 (0th digit of pi) is the ...
22
votes
19answers
3k views

ASCII art reflection

In this challenge, you will be given a text block, and you need to perform reflection on the text. Input: A string to be reflected. The text may not be supplied as an array whose elements are the ...