All Questions

Filter by
Sorted by
Tagged with
44 votes
68 answers
9k views

Generate Pascal's triangle

Pascal's triangle is generated by starting with a 1 on the first row. On subsequent rows, the number is determined by the sum of the two numbers directly above it to the left and right. To ...
Peter Olson's user avatar
  • 7,712
147 votes
78 answers
25k views

Interpret brainfuck

Write the shortest program in your favourite language to interpret a brainfuck program. The program is read from a file. Input and output are standard input and standard output. Cell size: 8bit ...
Alexandru's user avatar
  • 6,066
78 votes
261 answers
25k views

Is this even or odd?

Note: There is not been a vanilla parity test challenge yet (There is a C/C++ one but that disallows the ability to use languages other than C/C++, and other non-vanilla ones are mostly closed too), ...
Matthew Roh's user avatar
  • 5,353
66 votes
234 answers
18k views

Add two numbers

Input: Two integers. Preferably decimal integers, but other forms of numbers can be used. These can be given to the code in standard input, as arguments to the program or function, or as a list. ...
anna328p's user avatar
  • 6,336
22 votes
24 answers
2k views

Tips for golfing in sed

What general tips do you have for golfing in sed? I'm looking for ideas which can be applied to code-golf problems and which are also at least somewhat specific to sed (e.g. "remove comments" is not ...
Toby Speight's user avatar
  • 6,218
96 votes
15 answers
11k views

Create a programming language that only appears to be unusable

Robbers' challenge thread is here. Cops' challenge: Design a programming language that appears to be unusable for programming, but admits computation (or at least completion of the task) through some ...
feersum's user avatar
  • 31.3k
30 votes
8 answers
3k views

crossed out 44 is still regular 44 ;(

Introduction On March 24th, 2015 @isaacg golfed his Pyth answer from 44 to 42 bytes. Since a crossed out 44 (44) looks a lot like a regular 44, @Optimizer made the following comment: striked out ...
Kevin Cruijssen's user avatar
24 votes
14 answers
4k views

Converting integers to English words

The goal of this code golf is to convert integers to English words. The program prompts for input. If this input isn't an integer, print NaN. If it is an integer,...
ProgramFOX's user avatar
  • 8,351
20 votes
26 answers
5k views

The Work Day Countdown

I just had a genius idea for making the work-life easier - a countdown to a specific date which only counts workdays. The basic task is to create a countdown to a specific date which only includes ...
Hille's user avatar
  • 389
90 votes
212 answers
21k views

Find the Factorial!

Create the shortest program or function that finds the factorial of a non-negative integer. The factorial, represented with ! is defined as such $$n!:=\begin{...
Kevin Brown-Silva's user avatar
67 votes
140 answers
11k views

Reverse stdin and place on stdout

Requirements: Take an input on stdin including new lines / carriage returns of unlimited length (only bounded by system memory; that is, there is no inherent limit in the program.) Output the reverse ...
Thomas O's user avatar
  • 3,318
62 votes
48 answers
7k views

Are the brackets fully matched?

You must write a program or function that takes a string of brackets and outputs whether or not that string is fully matched. Your program should print a truthy or falsy value, and IO can be in any ...
DJMcMayhem's user avatar
  • 58.9k
43 votes
57 answers
8k views

Catalan Numbers

The Catalan numbers (OEIS) are a sequence of natural numbers often appearing in combinatorics. The nth Catalan number is the number of Dyck words (balanced strings of parenthesis or brackets such as <...
a spaghetto's user avatar
  • 11.2k
33 votes
33 answers
3k views

Say What You See

The "Look and say" or "Say what you see" sequence is a series of numbers where each describes the last. ...
HeyLlama's user avatar
  • 461
28 votes
11 answers
3k views

Tips for golfing in Lua

What general tips do you have for golfing in Lua? I'm looking for ideas that can be applied to code golf problems in general that are at least somewhat specific to Lua (e.g. "remove comments" is not ...
scheurneus's user avatar
22 votes
10 answers
1k views

Tips for golfing in Prolog

What general tips do you have for golfing in Prolog? I am looking for ideas that can be applied to code golf problems in general that are at least somewhat specific to Prolog (e.g. one letter ...
Fatalize's user avatar
  • 38.4k
22 votes
15 answers
2k views

Tips for Code Golfing in Desmos

Desmos is mainly used as an online graphing calculator, but its graphical and mathematical functionalities can also be applied in certain coding challenges. I know not that many people use Desmos on ...
Aiden Chow's user avatar
  • 12.7k
16 votes
13 answers
2k views

Tips for golfing in MATLAB

What general tips do you have for golfing in MATLAB? I'm looking for ideas that can be applied to code golf problems in general that are at least somewhat specific to MATLAB (e.g. "remove comments" is ...
RAM's user avatar
  • 937
144 votes
566 answers
46k views

Shortest infinite loop producing no output

Your task is to create the shortest infinite loop! The point of this challenge is to create an infinite loop producing no output, unlike its possible duplicate. The reason to this is because the code ...
user41805's user avatar
  • 13.1k
95 votes
131 answers
20k views

Print this diamond

This question has been spreading like a virus in my office. There are quite a variety of approaches: Print the following: ...
Eric Wilson's user avatar
  • 1,059
86 votes
221 answers
16k views

Count up forever

Write a program that counts up forever, starting from one. Rules: Your program must log to STDOUT or an acceptable alternative, if ...
vrwim's user avatar
  • 2,499
46 votes
78 answers
10k views

Is it a leap year?

This challenge is quite simple. You will take an input which will be a year from 1801 to 2400, and output if it is a leap year or not. Your input will have no newlines or trailing spaces: ...
user avatar
301 votes
451 answers
125k views

Add a language to a polyglot

This is an answer-chaining challenge in which each answer builds on the previous answer. I recommend sorting the thread by "oldest" in order to be sure about the order in which the posts are ...
user avatar
239 votes
115 answers
43k views

Print every character your program doesn't have

Your task is to build a program (using only printable ASCII characters and/or tabs and newlines) that prints out exactly the characters in the printable ASCII space (...
Joe Z.'s user avatar
  • 34.7k
94 votes
173 answers
16k views

Print a Tabula Recta!

The Tabula Recta (sometimes called a 'Vigenere Table'), was created by Johannes Trithemius, and has been used in several ciphers, including all variants of Bellaso's Vigenere cipher and the Trithemius ...
user avatar
87 votes
135 answers
13k views

Collatz Conjecture (OEIS A006577)

This is the Collatz Conjecture (OEIS A006577): Start with an integer n > 1. Repeat the following steps: If n is even, divide it by 2. If n is odd, multiply it by 3 and add 1. It is proven that ...
Doorknob's user avatar
  • 71.4k
74 votes
139 answers
11k views

Make a ;# interpreter

I recently created a new language called ;# (pronounced "Semicolon Hash") which only has two commands: ; add one to ...
caird coinheringaahin g's user avatar
47 votes
85 answers
8k views

Greatest Common Divisor

Your task is to compute the greatest common divisor (GCD) of two given integers in as few bytes of code as possible. You may write a program or function, taking input and returning output via any of ...
Mike Shlanta's user avatar
36 votes
13 answers
3k views

Tips for golfing in vim

I've recently realized how vim works great for golfing, especially for kolmogorov-complexity. Also, according to meta vim is a perfectly acceptable 'programming language' at least, for the scope of ...
DJMcMayhem's user avatar
  • 58.9k
35 votes
35 answers
7k views

Random Golf of the Day #1: Shuffle an Array

About the Series I will be running a little series of code-golf challenges revolving around the theme of randomness. This will basically be a 9-Hole Golf Course, but spread out over several questions....
Martin Ender's user avatar
23 votes
18 answers
2k views

Tips for golfing in Japt

Now that I'm thoroughly addicted to Code Golf, it's probably about time that I try to pick up a few golfing languages. Given that I play almost exclusively in JavaScript, Japt seems like the logical ...
Shaggy's user avatar
  • 41.6k
15 votes
15 answers
2k views

Golf the Subset-Sum Problem

Task Given a list of space-delimited integers as input, output all unique non-empty subsets of these numbers that each subset sums to 0. Test Case Input: ...
arshajii's user avatar
  • 2,172
461 votes
50 answers
173k views

Images with all colors

Similar to the images on allrgb.com, make images where each pixel is a unique color (no color is used twice and no color is missing). Give a program that generates such an image, along with a ...
Mark Jeronimus's user avatar
117 votes
84 answers
42k views

Shortest code that raises a SIGSEGV

Write the shortest code that raises a Segmentation Fault (SIGSEGV) in any programming language.
Anil Arya's user avatar
  • 1,369
93 votes
23 answers
12k views

Programming a Pristine World

Let's define a pristine program as a program that does not have any errors itself but will error if you modify it by removing any contiguous substring of \$N\$ characters, where \$1 \le N < \text{...
Calvin's Hobbies's user avatar
69 votes
126 answers
9k views

Print/Output the L-phabet

Inspired by George Gibson's Print a Tabula Recta. You are to print/output this exact text: ...
Leaky Nun's user avatar
  • 49.6k
49 votes
19 answers
3k views

Tips for golfing in The Shakespeare Programming Language

What general tips do you have for golfing in The Shakespeare Programming Language? I'm looking for ideas which can be applied to code-golf problems and which are also at least somewhat specific to SPL ...
xenia's user avatar
  • 8,102
45 votes
23 answers
4k views

Levenshtein Distance

While there are many edit distance questions, such as this one, there isn't a simple question to write a program that calculates the Levenshtein distance. Some Exposition The Levenshtein edit ...
Sherlock9's user avatar
  • 12.2k
36 votes
17 answers
12k views

Find the nth decimal of pi

There are already 30 challenges dedicated to pi but not a single one asks you to find the nth decimal, so... Challenge For any integer in the range of ...
Bassdrop Cumberwubwubwub's user avatar
36 votes
49 answers
4k views

Least Common Multiple

The least common multiple of a set of positive integers A is the smallest postive integer B such that, for each ...
user avatar
28 votes
12 answers
2k views

Tips for golfing in TI-BASIC

What general tips do you have for golfing in TI-BASIC for the TI-83/84+ series calculators? I'm looking for ideas which can be applied to code-golf problems and which are also at least somewhat ...
lirtosiast's user avatar
  • 21.4k
28 votes
16 answers
3k views

Tips for golfing in Scala

What general tips do you have for golfing in Scala? I'm looking for ideas that can be applied to code golf problems in general that are at least somewhat specific to Scala (e.g. "remove comments" is ...
user unknown's user avatar
  • 4,591
24 votes
26 answers
3k views

Find the prime factors

In this task, you have to write a program, that computes the prime factors of a number. The input is a natural number 1 < n < 2^32. The output is a list of the prime factors of the number in the ...
FUZxxl's user avatar
  • 10.1k
21 votes
16 answers
7k views

Tips for Golfing in T-SQL

What general tips do you have for golfing in T-SQL? I'm looking for ideas that can be applied to code golf problems in general that are at least somewhat specific to T-SQL. Please post one tip per ...
Michael B's user avatar
  • 1,631
18 votes
11 answers
1k views

Tips for golfing in Octave

What general tips do you have for golfing in Octave? I'm looking for ideas that can be applied to code golf problems in general that are at least somewhat specific to Octave (e.g. "remove comments" is ...
RAM's user avatar
  • 937
42 votes
17 answers
6k views

Tips for restricted source in Python

Just like code-golf, restricted-source pushes one to exploit quirks and hidden features of the Python language. We already have a place to collect all these tips for code-golf, those for restricted-...
Wheat Wizard's user avatar
  • 96.5k
198 votes
212 answers
45k views

The Programming Language Quiz

Congratulations to Dennis who won both the cops' and the robbers' challenge! Calvin's Hobbies has already delivered on his promise and wrote this challenge for Dennis for winning the robbers' ...
Martin Ender's user avatar
197 votes
120 answers
27k views

I'm not the language you're looking for!

Isn't it annoying when you find a piece of code and you don't know what language it was written in? This challenge attempts to somewhat solve this. Challenge You will have to write a program that ...
Blue's user avatar
  • 28.5k
145 votes
333 answers
31k views

Shortest code to produce infinite output

Write the shortest code you can that produces an infinite output. That's all. You code will only be disqualified if it stops producing output at some point. As always in code golf, the shortest code ...
tbodt's user avatar
  • 2,416
111 votes
286 answers
18k views

Output with the same length as the code

In this challenge, you should write a program or function which takes no input and prints or returns a string with the same number of bytes as the program itself. There are a few rules: You may only ...
Martin Ender's user avatar

15 30 50 per page
1
2
3 4 5
93