Communities

Writing
Writing
Codidact Meta
Codidact Meta
The Great Outdoors
The Great Outdoors
Photography & Video
Photography & Video
Scientific Speculation
Scientific Speculation
Cooking
Cooking
Electrical Engineering
Electrical Engineering
Judaism
Judaism
Languages & Linguistics
Languages & Linguistics
Software Development
Software Development
Mathematics
Mathematics
Christianity
Christianity
Code Golf
Code Golf
Music
Music
Physics
Physics
Linux Systems
Linux Systems
Power Users
Power Users
Tabletop RPGs
Tabletop RPGs
Community Proposals
Community Proposals
tag:snake search within a tag
answers:0 unanswered questions
user:xxxx search by author id
score:0.5 posts with 0.5+ score
"snake oil" exact phrase
votes:4 posts with 4+ votes
created:<1w created < 1 week ago
post_type:xxxx type of post
Search help
Notifications
Mark all as read See all your notifications »
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.

71%
+3 −0
Sandbox Create a range grid

posted 2y ago by Razetime‭

Article code-golf matrix
33%
+1 −4
Challenges Small integer swapping

In this simple challenge, create a short program that takes 2 ints as input, output them, swap their places, then output them again. Those 2 integers can't be the same number. The program with the ...

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

Question code-golf number
66%
+2 −0
Challenges Make my value binary

Challenge What do computers understand? That's right, binary. All files are turned into binary digits when you run them, but what if I suggest giving you an int then turn it into it's binary value...

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

Question code-golf number
80%
+6 −0
Challenges Shape of an array

Given a non-ragged array (an array where all sub-arrays at a particular level have the same length) of non-negative integers, answer its shape, that is, the length along every dimension. You may as...

6 answers  ·  posted 3y ago by Adám‭  ·  last activity 2y ago by south‭

Question code-golf
60%
+1 −0
Sandbox Word wrap a string

posted 2y ago by celtschk‭

Article code-golf string
66%
+2 −0
Sandbox Create a finite projective plane of order $n$

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

Article code-golf math
60%
+1 −0
Challenges Stairs? Stairs! Stairs.

Challenge Make a program that takes input of an integer that's $n > 1$ and print out a staircase using a specific character for stair basing (hashes (#) for demonstration; you can use spaces,...

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

81%
+7 −0
Challenges Operation "Find The Operator"

Challenge Make a program that takes input of 3 non-negative integers: a result and 2 other values that once calculated results to the 3rd value. The program must figure out how to get the 2 fir...

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

Question code-golf math number
77%
+5 −0
Challenges Diagonalized alphabet

Task Print the following: ABDFHJLNPRTVXZ CABDFHJLNPRTVX ECABDFHJLNPRTV GECABDFHJLNPRT IGECABDFHJLNPR KIGECABDFHJLNP MKIGECABDFHJLN OMKIGECABDFHJL QOMKIGECABDFHJ SQOMKIGECABDFH USQOMKIGE...

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

88%
+13 −0
Challenges Evaluate a single variable polynomial equation

Challenge Given a list of n numbers and x, compute $a + bx^1 + cx^{2} + ... + zx^{n-1}$, where a is the first value in the list, b is the second, etc. n is at most 256 and at least 0. The input va...

20 answers  ·  posted 3y ago by moony‭  ·  last activity 2y ago by south‭

Question code-golf math
50%
+0 −0
Sandbox Compute T-shirt size

posted 2y ago by Razetime‭

77%
+5 −0
Challenges Given the preorder and the inorder of a tree, output the postorder

Definitions A binary tree is either a null (leaf), or an object (node). A node contains a value (non-negative integer) and two pointers (left and right) to two separate binary trees. A binary tre...

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

Question code-golf
77%
+5 −0
Challenges Prime Difference

Given an integer n, output the smallest prime such that the difference between it and the next prime is at least n. For example, if n=5, you would output 23, since the next prime is 29, and 29-23&...

8 answers  ·  posted 3y ago by Quintec‭  ·  last activity 2y ago by radarek‭

Question code-golf
86%
+11 −0
Challenges Weave Strings Together

Given a list of strings(and optionally, their length) as input, weave the strings together. Intro Your goal is to mimic the WV operator in Pip. Take a list of strings and alternate between their ...

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

Question code-golf string
86%
+11 −0
Challenges Merge two strings

Challenge Given two strings a and b, return the shortest string s so that s starts with a and ends with b. (Inspired by https://chat.stackexchange.com/transcript/message/57816868#57816868 ) Exam...

8 answers  ·  posted 3y ago by rak1507‭  ·  last activity 2y ago by radarek‭

Question code-golf
84%
+9 −0
Challenges Coat of Many Colours

Challenge Given a list of unique colour names as input, sort them in the order that they first appear in Joseph's Amazing Technicolour Dreamcoat. Example Input: green, blue, red, brown Outpu...

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

77%
+5 −0
Challenges Repeat the characters

Given a string and a non-negative integer $n$, output a new string in which each character is repeated $n$ times. Test cases: "abc", 1 -> "abc" "Hello", 0 -> "" "double", 2 -> "ddo...

14 answers  ·  posted 2y ago by celtschk‭  ·  last activity 2y ago by south‭

Question code-golf string
81%
+7 −0
Challenges Make my number a set

Natural to set (set meaning an unordered collection with no duplicates, though answers may use and output lists instead) Recently I was brainstorming what a language with only (arbitrarily nested...

10 answers  ·  posted 3y ago by Wezl‭  ·  last activity 2y ago by radarek‭

Question code-golf number
81%
+7 −0
Challenges Bytes to Segfault

Challenge Cause the currently running program to receive the SIGSEGV signal (on Linux or other *nix systems) as fast as possible. What it does with the signal doesn't matter as long as it receives...

10 answers  ·  posted 3y ago by moony‭  ·  last activity 2y ago by radarek‭

Question code-golf *nix
71%
+3 −0
Challenges Generalized Sort

Challenge We all know and love the generic sort function, right? However, it only sorts based off one criterion - what if we want more? That's where you come in. Your task is to sort an array bas...

6 answers  ·  posted 2y ago by Moshi‭  ·  last activity 2y ago by radarek‭

Question code-golf sorting
80%
+6 −0
Challenges Golf golf challenge

The task is to create a program which displays a golf score as text. It takes 2 numbers as input, separated by space or new line: The first number is the par of the specific hole. The second nu...

5 answers  ·  posted 2y ago by Lundin‭  ·  last activity 2y ago by radarek‭

Question code-golf
84%
+9 −0
Challenges 1, 2, Fizz, 4, Buzz!

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‭

75%
+4 −0
Challenges Implement Rule 110

[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‭

71%
+3 −0
Q&A Tips for golfing in C

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 tips
40%
+0 −1
Challenges Tiny Turing-completeness

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‭

66%
+2 −0
Q&A Tips for golfing in Java

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 tips
77%
+5 −0
Challenges 99 Shortened Bottles of Beer

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‭

75%
+4 −0
Challenges Caesar shift cipher

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‭

71%
+3 −0
Challenges Run-length encode a byte sequence

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 encoding
75%
+4 −0
Sandbox Solve a Word Search!

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

Article code-golf
71%
+3 −0
Challenges Convert integer to English

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‭

71%
+3 −0
Challenges Find good coalitions

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
Challenges Truthify an array

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 3y ago by Razetime‭  ·  last activity 2y ago by General Sebast1an‭

84%
+9 −0
Challenges Obligatory Quine Challenge

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 quine
71%
+3 −0
Challenges Encode and decode floating point integers

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 number
66%
+2 −0
Q&A Tips for golfing in Python

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 tips
66%
+2 −0
Challenges Define a mathematical expression in English

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 math string
77%
+5 −0
Challenges Recreate the Stack Overflow logo

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 3y ago by General Sebast1an‭  ·  last activity 2y ago by Anonymous‭

75%
+4 −0
Challenges The Ludic Numbers

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 sequence
77%
+5 −0
Challenges Decode periodic decimal fractions

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‭

66%
+2 −0
Challenges Reverse your quine

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 quine
66%
+2 −0
Challenges Expand a polynomial

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 math
71%
+3 −0
Challenges Abbreviate everything

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 string
66%
+2 −0
Q&A Tips for golfing in Ruby

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 tips
85%
+10 −0
Challenges Create an Alphabet Diamond

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

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

60%
+1 −0
Sandbox Play dominoes using strings

posted 2y ago by Hakerh400‭

Article code-golf list
60%
+1 −0
Q&A Tips in golfing using PHP

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 tips
75%
+4 −0
Sandbox Expand a polynomial [FINALIZED]

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

60%
+1 −0
Challenges Getting perfect squares, differently

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‭