All Questions

Filter by
Sorted by
Tagged with
47 votes
14 answers
16k views

Tips for golfing in 05AB1E

Do you have any tips for code-golfing in 05AB1E, a golfing language created by Adnan? Your tips should be at least somewhat specific to 05AB1E. Please post one tip per answer.
Oliver Ni's user avatar
  • 10.6k
326 votes
177 answers
138k views

Tips for golfing in Python

What general tips do you have for golfing in Python? I'm looking for ideas which can be applied to code-golf problems and which are also at least somewhat specific to Python (e.g. "remove comments" is ...
moinudin's user avatar
  • 12.5k
88 votes
58 answers
17k views

Tips for golfing in Haskell

What general tips do you have for golfing in Haskell? I am looking for ideas that can be applied to code golf problems in general that are at least somewhat specific to Haskell. Please post only one ...
Animesh 'the CODER''s user avatar
106 votes
39 answers
27k views

Tips for golfing in Java

Are there any useful shortcuts that can be used in Java? As shown below, import already adds at least 17 characters to a program. ...
Rob's user avatar
  • 1,477
242 votes
450 answers
63k views

Golf you a quine for great good!

Using your language of choice, golf a quine. A quine is a non-empty computer program which takes no input and produces a copy of its own source code as its only output. No cheating -- that means ...
Rafe Kettler's user avatar
  • 2,697
515 votes
969 answers
188k views

"Hello, World!"

So... uh... this is a bit embarrassing. But we don't have a plain "Hello, World!" challenge yet (despite having 35 variants tagged with hello-world, and counting). While this is not the most ...
Martin Ender's user avatar
102 votes
44 answers
12k views

Tips for golfing in <all languages>

The aim of this post is to gather all the golfing tips that can be easily applied to <all languages> rather than a specific one. Only post answers that its ...
ajax333221's user avatar
  • 3,634
162 votes
61 answers
39k views

Tips for golfing in C

What general tips do you have for golfing in C? I'm looking for ideas that can be applied to code golf problems in general that are at least somewhat specific to C (e.g. "remove comments" is not an ...
Casey's user avatar
  • 3,539
173 votes
97 answers
67k views

Tips for golfing in JavaScript

What general tips do you have for golfing in JavaScript? I'm looking for ideas that can be applied to code golf problems in general that are at least somewhat specific to JavaScript (e.g. "remove ...
mellamokb's user avatar
  • 6,073
50 votes
49 answers
7k views

Tips for golfing in PowerShell

What general tips do you have for golfing in Windows PowerShell? I'm looking for ideas that can be applied to code golf problems in general that are at least somewhat specific to PowerShell (e.g. "...
Joey's user avatar
  • 12.9k
138 votes
29 answers
12k views

Making Future Posts Runnable Online with Stack Snippets [closed]

Stack Snippets were recently added to PPCG! Reminiscent of JSFiddle, Stack Snippets allow HTML, CSS, and JavaScript to be run directly in posts! Here is a very simple Stack Snippet: ...
Calvin's Hobbies's user avatar
15 votes
14 answers
3k views

I want 8 bits for every character!

This is the reverse of this challenge. Given an encoded list of codepoints and the characters used to encode it, you need to decompress it to its original string. For example, given the encoded list <...
naffetS's user avatar
  • 12.2k
75 votes
59 answers
20k views

Tips for code-golfing in C#

What general tips do you have for golfing in C#? I'm looking for ideas that can be applied to code golf problems in general that are at least somewhat specific to C# (e.g. "remove comments" is not an ...
jcolebrand's user avatar
  • 1,863
234 votes
366 answers
65k views

Is this number a prime?

Believe it or not, we do not yet have a code golf challenge for a simple primality test. While it may not be the most interesting challenge, particularly for "usual" languages, it can be nontrivial in ...
Dennis's user avatar
  • 210k
70 votes
23 answers
7k views

Tips for golfing in R

I'm looking for tips for golfing in the R statistical language. R is perhaps an unconventional choice for Golf. However, it does certain things very compactly (sequences, randomness, vectors, and ...
Ari B. Friedman's user avatar
52 votes
43 answers
7k views

Tips for golfing in Mathematica

What general tips do you have for golfing in Mathematica? I'm looking for ideas that can be applied to code golf problems in general that are at least somewhat specific to Mathematica (e.g. "remove ...
alephalpha's user avatar
  • 46.5k
78 votes
53 answers
35k views

Tips for golfing in Ruby

What general tips can you give for golfing in Ruby? I'm looking for ideas that can be applied to code golf problems in general that are specific to Ruby. (For example, "Remove comments" would not be ...
grokus's user avatar
  • 1,257
109 votes
43 answers
18k views

Tips for Golfing in ECMAScript 6 and above

This is similar to other "Tips for golfing in <...>" but specifically targeting the newer features in JavaScript brought up in ECMAScript 6 and above. JavaScript inherently is a very verbose ...
Optimizer's user avatar
  • 26.5k
70 votes
43 answers
11k views

Tips for golfing in Bash

What general tips do you have for golfing in Bash? I'm looking for ideas that can be applied to code golf problems in general that are at least somewhat specific to Bash (e.g. "remove comments" is not ...
manatwork's user avatar
  • 20k
289 votes
73 answers
79k views

We're no strangers to code golf, you know the rules, and so do I

Write the shortest program that prints the entire lyrics of "Never Gonna Give You Up" by Rick Astley. Rules: Must output the lyrics exactly as they appear in the above pastebin*. Here's the raw dump:...
Polynomial's user avatar
  • 4,506
550 votes
241 answers
134k views

Showcase of Languages

Notes This thread is open and unlocked only because the community decided to make an exception. Please do not use this question as evidence that you can ask similar questions here. Please do not ...
149 votes
330 answers
42k views

Fibonacci function or sequence

The Fibonacci sequence is a sequence of numbers, where every number in the sequence is the sum of the two numbers preceding it. The first two numbers in the sequence are both 1. Here are the first ...
C. K. Young's user avatar
  • 4,917
43 votes
18 answers
5k views

Tips for golfing in APL

I started one code golf challenge recently and it seems like the winner is GolfScript (surprise, surprise!). What's interesting is that there was another very strong competitor that had all chances to ...
gthacoder's user avatar
  • 1,067
65 votes
113 answers
17k views

List of primes under a million

This is my first code golf question, and a very simple one at that, so I apologise in advance if I may have broken any community guidelines. The task is to print out, in ascending order, all of the ...
Delan Azabani's user avatar
52 votes
26 answers
14k views

Tips for golfing in Perl?

What general tips do you have for golfing in Perl? I'm looking for ideas that can be applied to code golf problems in general that are at least somewhat specific to Perl (e.g. "remove comments" is not ...
commando's user avatar
  • 1,103
49 votes
35 answers
8k 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 x86/x64 machine code? If the tip only applies to a certain environment or calling convention, please ...
ბიმო's user avatar
  • 16.7k
194 votes
413 answers
74k views

1, 2, Fizz, 4, Buzz

Introduction In our recent effort to collect catalogues of shortest solutions for standard programming exercises, here is PPCG's first ever vanilla FizzBuzz challenge. If you wish to see other ...
Beta Decay's user avatar
  • 23.3k
41 votes
40 answers
10k views

Tips for golfing in PHP

What general tips do you have for golfing in PHP? I'm looking for ideas that can be applied to code golf problems in general that are at least somewhat specific to PHP (e.g. "remove comments" is not ...
JiminP's user avatar
  • 3,472
153 votes
82 answers
23k 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 ...
Julian Lachniet's user avatar
58 votes
25 answers
16k views

Tips for golfing in Jelly

Jelly is a tacit, golf-oriented programming language by our very own Dennis. It’s popping up in answers here more and more often, beating other golf-y languages like Pyth and CJam, both by using its ...
Lynn's user avatar
  • 68.1k
23 votes
12 answers
2k views

Tips for golfing in MATL

MATL is a golfing language created by Luis Mendo. MATL has proven to be highly competitive, often beating submissions in other golfing languages such as Pyth, CJam and Jelly. What are some useful ...
Stewie Griffin's user avatar
110 votes
328 answers
22k views

Simple cat program

One of the most common standard tasks (especially when showcasing esoteric programming languages) is to implement a "cat program": read all of STDIN and print it to STDOUT. While this is named after ...
Martin Ender's user avatar
62 votes
30 answers
19k views

Tips for golfing in C++

What general tips do you have for golfing in C++? I'm looking for ideas that can be applied to code golf problems in general that are at least somewhat specific to C++ (e.g. "remove comments" is not ...
moinudin's user avatar
  • 12.5k
43 votes
18 answers
6k views

Tips for golfing in GolfScript

What, this post doesn't exist yet? Of course, GolfScript is made for golfing, so you might think that no specific tips are really needed. But to make full use of GolfScript's features, you need to ...
Ilmari Karonen's user avatar
52 votes
6 answers
5k views

Language Design: 2-D Pattern Matching

This is Fortnightly Challenge #6. Theme: Language Design There's a chatroom for this challenge. Come and join us if you want to discuss ideas! And now for something completely different... This ...
PhiNotPi's user avatar
  • 29k
18 votes
8 answers
2k views

Tips for golfing in Whitespace

What general tips do you have for golfing in Whitespace? I'm looking for ideas which can be applied to code-golf problems and which are also at least somewhat specific to Whitespace (e.g. "remove ...
xenia's user avatar
  • 8,102
150 votes
160 answers
22k views

I double the source, you double the output!

Your task, if you wish to accept it, is to write a program that outputs a positive integer (higher than 0). The tricky part is that if I duplicate your source code, the output must be double the ...
Mr. Xcoder's user avatar
  • 42.3k
19 votes
33 answers
3k views

Tips for golfing in VBA

Similar to this, this, and this question... What general tips do you have for golfing in VBA? I'm looking for ideas that can be applied to code golf problems in ...
Gaffi's user avatar
  • 3,597
144 votes
93 answers
31k views

Largest Number Printable

Your goal is to write a program that prints a number. The bigger the number, the more points you'll get. But be careful! Code length is both limited and heavily weighted in the scoring function. Your ...
Vereos's user avatar
  • 4,433
70 votes
48 answers
6k 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 ...
PhiNotPi's user avatar
  • 29k
29 votes
8 answers
3k views

Tips for golfing in Julia

What general tips do you have for golfing in Julia? I'm looking for ideas that can be applied to code golf problems in general that are at least somewhat specific to Julia (e.g. "remove comments" is ...
Jonathan Van Matre's user avatar
40 votes
17 answers
4k views

Golf a mutual quine

Using two languages of your choice, write the smallest “mutual quine” you can. That is, write a program P in language A that outputs the source code for a program Q in language B, such ...
dan04's user avatar
  • 6,581
13 votes
10 answers
3k 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. Lower ...
Johannes Kuhn's user avatar
358 votes
7 answers
50k views

Upgoat or Downgoat?

Given an image of a goat, your program should best try to identify whether the goat is upside down, or not. Examples These are examples of what the input may be. Not actual inputs Input: Output: <...
Downgoat's user avatar
  • 28.9k
44 votes
34 answers
4k views

Tips for golfing in CJam

CJam is a GolfScript-inspired stack-based golfing language, created by PPCG user aditsu. So, in the vein of other language-specific tips questions: What general tips do you have for golfing in CJam? ...
Martin Ender's user avatar
618 votes
320 answers
237k views

Produce the number 2014 without any numbers in your source code

Note to challenge writers as per meta consensus: This question was well-received when it was posted, but challenges like this, asking answerers to Do X without using Y are likely to be poorly received....
Joe Z.'s user avatar
  • 34.7k
172 votes
489 answers
35k views

Implement a Truth-Machine

A truth-machine (credits goes to this guy for coming up with it) is a very simple program designed to demonstrate the I/O and control flow of a language. Here's what a truth-machine does: Gets a ...
a spaghetto's user avatar
  • 11.2k
136 votes
144 answers
44k views

Obfuscated Hello World

Create the shortest possible obfuscated program that displays the text "Hello World". In order to be considered an obfuscated program, it must meet at least two of the following requirements: Does ...
Kevin Brown-Silva's user avatar
93 votes
168 answers
23k views

"99 Bottles of Beer"

Write a program that outputs the lyrics to 99 Bottles of Beer, in as few bytes as possible. Lyrics: ...
GamrCorps's user avatar
  • 7,502
92 votes
159 answers
13k views

Determine whether strings are anagrams

Challenge Given two strings, work out if they both have exactly the same characters in them. Example Input word, wrdo This returns true because they are the ...
Tom Gullen's user avatar
  • 1,229

15 30 50 per page
1
2 3 4 5
93