All Questions

Filter by
Sorted by
Tagged with
44
votes
188answers
13k 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. ...
35
votes
35answers
6k 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....
18
votes
18answers
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 ...
15
votes
15answers
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: ...
121
votes
477answers
36k 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 ...
57
votes
36answers
4k views

Write the shortest self-identifying program (a quine variant)

Write a program that will generate a "true" output iff the input matches the source code of the program, and which generates a "false" output iff the input does not match the source code of the ...
14
votes
12answers
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 ...
56
votes
32answers
5k 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 ...
27
votes
20answers
2k views

Tips for golfing in x86/x64 machine code

I noticed that there's no such question, so here it is: Do you have general tips for golfing in machine code? If the tip only applies to a certain environment or calling convention, please specify ...
221
votes
106answers
39k 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 (...
73
votes
145answers
16k views

“99 Bottles of Beer”

Write a program that outputs the lyrics to 99 Bottles of Beer, in as few bytes as possible. Lyrics: ...
76
votes
52answers
24k views

Shortest code that raises a SIGSEGV

Write the shortest code that raises a Segmentation Fault (SIGSEGV) in any programming language.
33
votes
18answers
7k 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 ...
59
votes
39answers
12k views

Find the Smoothest Number

Your challenge is to find the smoothest number over a given range. In other words, find the number whose greatest prime factor is the smallest. A smooth number is one whose largest prime factor is ...
67
votes
208answers
20k 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), ...
16
votes
9answers
962 views

Base Conversion With Strings

Introduction We've have a few base conversion challenges here in the past, but not many designed to tackle arbitrary length numbers (that is to say, numbers that are long enough that they overflow ...
29
votes
28answers
3k views

Josephus problem (counting out)

The challenge Write a function that takes two positive integers n and k as arguments and returns the number of the last person remaining out of n after counting out each k-th person. This is a code-...
24
votes
9answers
2k views

Tips for Golfing in Brain-Flak

Brain-flak is a stack-based turing-tarpit language, written collaboratively between me, DJMcMayhem, and 1000000000. Some users are very experienced in the mysterious ways of Brain-Flak. So I thought ...
23
votes
23answers
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 ...
18
votes
10answers
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 ...
432
votes
47answers
149k 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 ...
241
votes
278answers
86k 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 made. ...
189
votes
209answers
41k 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' ...
183
votes
111answers
23k 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 ...
85
votes
67answers
14k views

Print your code backwards - reverse quine

Write a program that prints its own source code out backwards, in other words an eniuq. Scoring: +50 if you use pull data from the Internet. +25 if you read your own source code. +1 point per ...
81
votes
139answers
12k views

Print a Tabula Recta!

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 ...
46
votes
24answers
6k views

Tips for golfing in Pyth

Pyth is a Python-inspired procedural programming language, created by PPCG user isaacg. What general tips do you have for golfing in Pyth? I'm looking for ideas that can be applied to code golf ...
70
votes
120answers
15k views

The alphabet in programming languages

Our task is to, for each letter of the (English) alphabet, write a program that prints the alphabet, in a language whose name starts with that letter. Input: none Output: ...
66
votes
95answers
9k 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 ...
28
votes
17answers
4k views

Decipher a Vigenère ciphertext

The Vigenère cipher was a simple polyalphabetic cipher that basically applied one of several Caesar ciphers, according to a key. Bascially the letters in the key indicate which shifted alphabet to use....
16
votes
16answers
3k 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 ...
34
votes
17answers
4k views

Wind me a number snake!

Given an input integer n, draw a number snake, that is, a grid measuring n x n consisting of the numbers ...
23
votes
50answers
6k views

Is string X a subsequence of string Y?

Given strings X and Y, determine whether X is a subsequence of Y. The empty string is regarded as a subsequence of every string. (E.g., '' and ...
39
votes
21answers
3k 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 ...
39
votes
9answers
5k views

“Convenient palindrome” checker

If you've ever tried to write palindromic code before, you'd know how much brackets tend to get in your way. ()() is not a palindrome, even though it kinda looks ...
30
votes
24answers
2k 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. ...
29
votes
12answers
3k views

Word Search Puzzle

Given a rectangular text as a word search puzzle and a search string, determine if the text contains the search string. The search string may appear: horizontally, vertically or diagonally forwards ...
12
votes
6answers
2k views

Encode a program with the fewest distinct characters possible,

The goal is to write a program that encodes an other program (input) with the fewest character possible. Scoring The score is equal to the different number of characters needed for the output. ...
19
votes
4answers
2k views

Most efficient cubifier

Cubically is too tedious to manually write any code in. Your challenge is to translate ASCII text into Cubically source code. Cubically This is just a quick run-down of Cubically; the repository has ...
27
votes
16answers
2k views

Compute the multinomial coefficient

Time for another easy challenge in which all can participate! The multinomial theorem states: The expression in parentheses is the multinomial coefficient, defined as: Allowing the terms ki to ...
18
votes
48answers
2k views

Find the occurrences of a character in an input string

Challenge Write a program that, given a string x which is 10 characters long and a character y, outputs the number of times ...
393
votes
156answers
244k views

Write a program that makes 2 + 2 = 5 [closed]

Write a program that seemingly adds the numbers 2 and 2 and outputs 5. This is an underhanded contest. Your program cannot output any errors. Watch out for memory holes! Input is optional. ...
238
votes
56answers
49k views

Survival Game - Create Your Wolf

The Board The Board is a two dimensional array of cells. Cells are populated by Animals. Every day, all Animals on the Board simultaneously make one move. If two or more Animals move to the same cell,...
108
votes
51answers
14k views

Fewest (distinct) characters for Turing Completeness

Summary: For any given language, what is the smallest amount of unique characters for your language to be Turing-Complete? Challenge: For any language of your choice, find the smallest subset of ...
111
votes
48answers
32k views

Program that creates larger versions of itself (quine-variant)

You are to write a program that will output source code that is Larger than the original program (character wise) Will print another program larger than itself when run (i.e. the new program is also ...
97
votes
232answers
15k 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 ...
99
votes
9answers
6k views

Write an interpreter for 99

99 (pronounced "ninety-nine") is a brand new Esoteric programming language (not to be confused with 99, note the italics). Your task in this challenge is to write an interpreter for 99 that is as ...
93
votes
36answers
11k views

The Versatile Integer Printer

Write a piece of code that is executable in at least three different languages. The code must output the integer 1 in language number one, ...
48
votes
88answers
7k views

Alphabet triangle

You are to print this exact text: ...
43
votes
21answers
5k views

One Ring to rule them all. One String to contain them all

Objectives: Output a String which contains every positive integer strictly below 1000. The obvious answer would be to concatenate every one of them, and that would create a String of 2890 characters (...

15 30 50 per page