### Communities

tag:snake search within a tag
user:xxxx search by author id
score:0.5 posts with 0.5+ score
"snake oil" exact phrase
created:<1w created < 1 week ago
post_type:xxxx type of post
Challenges

# Posts tagged code-golf

Code golf is a winning criterion, where users seek to solve the challenge in as few bytes of source code as possible.

This tag doesn't have a detailed wiki yet.

246 posts
84%
+9 −0

The task Output the first 100 elements of the infamous FizzBuzz sequence. How? The FizzBuzz sequence is the sequence of decimal integers from 1 to 100 inclusive, but: If the integer is divisi...

20 answers  ·  posted 3y ago by Dion‭  ·  last activity 2y ago by celtschk‭

Question code-golf
75%
+4 −0

[Rule 110] is a Turing complete cellular automaton. It is defined as follows: Take as initial value a sequence of symbols that's infinite to both sides, which consists only of two different symbol...

1 answer  ·  posted 2y ago by celtschk‭  ·  last activity 2y ago by Moshi‭

Question code-golf
71%
+3 −0

C is a language I use most apart from Python and as someone who likes code golf challenges, what tips are there to golf in C?

4 answers  ·  posted 2y ago by General Sebast1an‭  ·  edited 2y ago by General Sebast1an‭

Question code-golf
40%
+0 −1

Your challenge today is to golf a program to interpret something Turing-complete. You may use any Turing-complete system for this so long as it is not the source language of the challenge - even a...

0 answers  ·  posted 2y ago by AndrewTheCodegolfer‭  ·  edited 2y ago by AndrewTheCodegolfer‭

Question code-golf
66%
+2 −0

This is a list of golfing tips for the language known as Java. If you have a tip, add it in!

7 answers  ·  posted 2y ago by General Sebast1an‭  ·  last activity 2y ago by General Sebast1an‭

Question code-golf
77%
+5 −0

Disclaimer This challenge also exists in CGCC, but if you want to compete here (too), then hop in! Challenge Recreate "99 Bottles of Beer on the Wall", using the least bytes possible. Lyrics: ...

13 answers  ·  posted 2y ago by General Sebast1an‭  ·  last activity 2y ago by General Sebast1an‭

Question code-golf
75%
+4 −0

Introduction What is the Caesar shift cipher (ROT$n$)? It's basically a cipher sequence that changes a letter's value from the number chosen. If we use ROT1 on "games", we get "hbnft". The basic i...

7 answers  ·  posted 2y ago by General Sebast1an‭  ·  edited 2y ago by General Sebast1an‭

Question code-golf
71%
+3 −0

Run-length encoding is a simple compression technique which compresses sequences of repeating identical bytes. The encoding rules for this task are as follows: Any sequence of $n$ identical bytes...

2 answers  ·  posted 2y ago by celtschk‭  ·  last activity 2y ago by Moshi‭

Question code-golf
71%
+3 −0
Sandbox Solve a Word Search!

posted 2y ago by Moshi‭  ·  edited 2y ago by Moshi‭

Article code-golf
50%
+1 −1

posted 2y ago by General Sebast1an‭  ·  edited 2y ago by General Sebast1an‭

Article code-golf
71%
+3 −0

Given a non-negative integer up to $999\,999\,999$, write it in English. The input number can be in any form other than English (though you'll typically want to use the native integer type of your...

3 answers  ·  posted 2y ago by celtschk‭  ·  last activity 2y ago by Moshi‭

Question code-golf
71%
+3 −0

As you might know, there were elections in Germany, and now the parties have to form a government coalition. Let's help them with it! A good coalition has the strict majority of seats (that is, mo...

2 answers  ·  posted 2y ago by celtschk‭  ·  last activity 2y ago by Moshi‭

Question code-golf
81%
+7 −0

Jelly has an atom called untruth, which when given indices, creates an array with 1s at those places: [2,4] → [0,1,0,1]. You are required to perform the inverse of this. Given a 2D boolean array, ...

10 answers  ·  posted 2y ago by Razetime‭  ·  last activity 2y ago by General Sebast1an‭

Question code-golf
84%
+9 −0

Rules 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 -- ...

9 answers  ·  posted 3y ago by ATaco‭  ·  last activity 2y ago by General Sebast1an‭

Question code-golf
71%
+3 −0

Imagine you have only one byte (8 bits) to store a value, but need to store values from $0$ to $4032$. Impossible, until you are also told that an error of 1/64 of the exact value does not matter. ...

2 answers  ·  posted 2y ago by celtschk‭  ·  last activity 2y ago by General Sebast1an‭

Question code-golf
66%
+2 −0

If you have any tips for golfing in Python, add them as answers to this post.

18 answers  ·  posted 2y ago by celtschk‭  ·  last activity 2y ago by General Sebast1an‭

Question code-golf
66%
+2 −0

Background Inspired by this challenge that is also a mathematical English translator. Challenge Write a program that translates a mathematical expression using English with the following specifi...

1 answer  ·  posted 2y ago by General Sebast1an‭  ·  edited 2y ago by General Sebast1an‭

Question code-golf
77%
+5 −0

Originally from Somewhere Else. I thought I'd continue making more drawing challenges here now that I discovered it. Make the Stack Overflow logo using the following criteria: The tray: ...

2 answers  ·  posted 2y ago by General Sebast1an‭  ·  last activity 2y ago by Anonymous‭

Question code-golf
75%
+4 −0

The Ludic Numbers are a sequence that pops up when you apply the sieve of eratosthenes to the natural numbers, completely removing the numbers every iteration. Here is how they are generated: The...

3 answers  ·  posted 2y ago by Razetime‭  ·  last activity 2y ago by General Sebast1an‭

Question code-golf
77%
+5 −0

Rational numbers in decimal representation can have an infinite periodic part. One common way to write this down is to repeat the periodic digits and then add three dots. Numbers without those thre...

2 answers  ·  posted 2y ago by celtschk‭  ·  edited 2y ago by General Sebast1an‭

Question code-golf
66%
+2 −0

Challenge Write a program that prints its reversed self. For example, if your code is foo() Then it'll output: )(oof Make sure that the quine is a valid one, as defined here: No cheatin...

4 answers  ·  posted 2y ago by General Sebast1an‭  ·  last activity 2y ago by celtschk‭

Question code-golf
66%
+2 −0

Challenge Given the roots of a polynomial (that is, the $x$ values where the polynomial evaluates to zero), as an array of real numbers, return the polynomial's coefficients. That is, given real ...

4 answers  ·  posted 2y ago by Moshi‭  ·  last activity 2y ago by Moshi‭

Question code-golf
71%
+3 −0

Challenge Make a program that takes input of a string and abbreviate it. All letters of an abbreviation are capitalized, so keep that in mind. Whitespace, numbers and non-English characters ar...

3 answers  ·  posted 2y ago by General Sebast1an‭  ·  last activity 2y ago by Hakerh400‭

Question code-golf
66%
+2 −0

If you have any tips for golfing in Ruby, share them as answers to this post.

1 answer  ·  posted 2y ago by snail_‭  ·  last activity 2y ago by snail_‭

Question code-golf
85%
+10 −0

Challenge Output the following text: A ABA ABCBA ABCDCBA ABCDEDCBA ...

11 answers  ·  posted 2y ago by dzaima‭  ·  last activity 2y ago by General Sebast1an‭

Question code-golf
60%
+1 −0
Sandbox Play dominoes using strings

posted 2y ago by Hakerh400‭

Article code-golf
60%
+1 −0

This is a list of golfing tips for the language known as Philippine Peso PHP. If you have a tip, add it in!

5 answers  ·  posted 2y ago by General Sebast1an‭  ·  last activity 2y ago by General Sebast1an‭

Question code-golf
75%
+4 −0

posted 2y ago by Moshi‭  ·  edited 2y ago by Moshi‭

Article code-golf
60%
+1 −0

Create a program that gets all perfect squares starting from 0 or 1 without using any methods of multiplication (repetitive addition) and exponentiation (repetitive multiplication). Output them for...

7 answers  ·  posted 2y ago by General Sebast1an‭  ·  last activity 2y ago by General Sebast1an‭

Question code-golf
75%
+4 −0

Inspired by this Rosetta Code article. Introduction Balanced Ternary is a method of representing integers using -1, 0 and 1 in base 3. Decimal 11 = (1 * 32) + (1 * 31) + (−1 * 30) = [1,1,-1] or ...

3 answers  ·  posted 2y ago by Razetime‭  ·  last activity 2y ago by Moshi‭

Question code-golf
50%
+0 −0

Lua's not really used much in golfing, so it'd be pretty cool to learn some golfing tricks when making answers using it. What golfing tips are there for Lua?

2 answers  ·  posted 2y ago by General Sebast1an‭  ·  last activity 2y ago by General Sebast1an‭

Question code-golf
50%
+0 −0

posted 2y ago by General Sebast1an‭

Article code-golf
71%
+3 −0

Background A House of I I went on an adventure Grabbed resources and making deeds Like start to work on the materials To build the shelter I need It was a marvelous one At least in the eyes ...

10 answers  ·  posted 2y ago by General Sebast1an‭  ·  last activity 2y ago by Quintec‭

Question code-golf
33%
+0 −2

posted 2y ago by General Sebast1an‭  ·  edited 2y ago by General Sebast1an‭

Article code-golf
71%
+3 −0

posted 2y ago by Razetime‭  ·  edited 2y ago by Razetime‭

Article code-golf
60%
+1 −0
Sandbox Generalized Sort

posted 2y ago by Moshi‭  ·  edited 2y ago by Moshi‭

Article code-golf
81%
+7 −0

Challenge Given an integer n>=4 as input create an ASCII art "prison door"* measuring n-1 characters wide and n characters high, using the symbols from the example below. Example ╔╦╗ ╠╬╣ ...

6 answers  ·  posted 2y ago by Shaggy‭  ·  last activity 2y ago by snail_‭

Question code-golf
75%
+4 −0

The task Given a positive integer as input, output tiled pyramids of this height. How? Let's say the inputted integer was n. From there, we output n lines of output, each having: A decreasing...

9 answers  ·  posted 3y ago by Dion‭  ·  last activity 2y ago by A username‭

Question code-golf
71%
+3 −0

Given two strings, I define their product as follows: If any of the two strings is empty, the product is the empty string. If the second string consists of a single character, the result ...

6 answers  ·  posted 2y ago by celtschk‭  ·  last activity 2y ago by Hakerh400‭

Question code-golf
50%
+0 −0

posted 2y ago by Lundin‭

Article code-golf
75%
+4 −0
Sandbox Compute the determinant

posted 2y ago by Moshi‭  ·  edited 2y ago by Moshi‭

Article code-golf
75%
+4 −0

The task is to generate the text of Lewis Caroll's Jabberwocky. The text, quoted from Wikipedia, is as follows (I've replaced a non-ASCII character with ASCII, otherwise it's direct copy&paste...

4 answers  ·  posted 3y ago by celtschk‭  ·  last activity 2y ago by General Sebast1an‭

Question code-golf
80%
+6 −0

Credit This challenge is taken with permission from https://www.mysterytwisterc3.org/en/challenges/level-1/beaver-code Description The encryption method is as follows: The plaintext is divided ...

6 answers  ·  posted 2y ago by rak1507‭  ·  last activity 2y ago by Shaggy‭

Question code-golf
28%
+0 −3

posted 2y ago by General Sebast1an‭  ·  edited 2y ago by General Sebast1an‭

Article code-golf
77%
+5 −0

Definition $F_{n}\left(0\right)=0$ $F_{n}\left(1\right)=1$ $F_{n}\left(x\right)=n\cdot F_{n}\left(x-1\right)+F_{n}\left(x-2\right)$ For example: \$F_{1}=\left[0,1,1,2,3,5,8,13,21,34,55,89...\ri...

3 answers  ·  posted 2y ago by rak1507‭  ·  edited 2y ago by General Sebast1an‭

Question code-golf
50%
+0 −0

posted 2y ago by General Sebast1an‭  ·  edited 2y ago by General Sebast1an‭

Article code-golf
50%
+0 −0
Sandbox Recreate modulo [cancelled]

posted 2y ago by General Sebast1an‭  ·  edited 2y ago by General Sebast1an‭

Article code-golf
66%
+2 −0

I have a question about everyone's favourite Code Golf editor https://tio.run. After picking a language, is there a sensible way to enter command line arguments to it, other than adding them manual...

0 answers  ·  posted 2y ago by Lundin‭  ·  edited 2y ago by Lundin‭

Question code-golf
60%
+1 −0

Challenge Create a program that takes input of a string and outputs an integer using the following calculation system: The string can only contain +, -, *, /, ^, ! (or a different character; ! ...

1 answer  ·  posted 2y ago by General Sebast1an‭  ·  edited 2y ago by General Sebast1an‭

Question code-golf
80%
+6 −0

Two words are anagrams of each other if the letters of one can be reordered to spell the other; e.g. ADOBE and ABODE are anagrams. An alternate way of describing it is that both words contain the s...

5 answers  ·  posted 2y ago by snail_‭  ·  edited 2y ago by General Sebast1an‭

Question code-golf