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

Code challenges of all types. For questions about golfing, bowling, etc, use Q&A. For questions about this community, use Meta. To get feedback on a challenge before posting it, use Sandbox.

Filters (None)
66%
+2 −0
Mark my beacons

Given a grid of numbers, mark the concentric areas around nonzero elements (beacons) decreasing from the value of the beacon till 1. For example, here are some grids with a single beacon: Size 1:...

0 answers  ·  posted 1y ago by Razetime‭  ·  last activity 1y ago by Moshi‭

81%
+7 −0
Find n Niven Numbers

Challenge A Niven number is a positive integer which is divisible by the sum of its digits. For example, 81 -> 8+1=9 -> 81%9=0. Your task is to find the first n Niven numbers, given n. Te...

7 answers  ·  posted 1y ago by Razetime‭  ·  last activity 1y ago by Shaggy‭

71%
+3 −0
Make a frequency table (histogram)

Challenge Given an array in any suitable format, create a frequency table for it. i.e: Pair each unique element with the number of times it appears in the array. You can return the frequency tabl...

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

71%
+3 −0
From the smallest seed

Challenge It's a bootstrapping challenge this time! Write a full program that, once run, writes the source code of another program that in turn, once run, writes the source code for another progra...

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

77%
+5 −0
Create a range grid

This challenge is based on the i. verb from J. A range grid is basically a range of m × n numbers fit into a rectangular grid with m rows and n columns. A 2×3 range grid would be: 0 1 2 3 4 5 ...

8 answers  ·  posted 2y ago by Razetime‭  ·  last activity 1y ago by Shaggy‭

84%
+9 −0
Looping counter

Looping counter Create an infinite loop that outputs lines of asterisks, with each line containing one more asterisk. Instead of the asterisk, any printable, non-whitespace character can be used. ...

19 answers  ·  posted 2y ago by celtschk‭  ·  last activity 7mo ago by H_H‭

86%
+11 −0
Can you give me half?

Challenge idea taken from: Eliseo D'Annunzio Task Provide code that evaluates to 0.5 numerically, i.e. the output must be recognized by your chosen language as a numeric value (Number, float, dou...

23 answers  ·  posted 2y ago by Razetime‭  ·  last activity 9mo ago by RubenVerg‭

80%
+6 −0
Keyword golfing

Many programming languages have the concept of keywords, special syntax items that are not just identifiers reserved by some library, but words reserved by the language itself. The challenge is to...

6 answers  ·  posted 2y ago by Lundin‭  ·  last activity 8mo ago by H_H‭

81%
+7 −0
Determine whether an integer is square-free

An integer is called square-free if it is not a multiple of a perfect square other than 1. For example, 42 is square-free, but 44 is not because it is a multiple of the perfect square 4 = 2². Your...

13 answers  ·  posted 2y ago by celtschk‭  ·  last activity 1y ago by Shaggy‭

75%
+4 −0
Find the IP address class

Task Given an IP address as a string, find its IP address class. For reference, here is a table: Class Leadingbits Numberof networks Addressesper network Total addressesin class Start...

6 answers  ·  posted 2y ago by Razetime‭  ·  last activity 2y ago by torres‭

80%
+6 −0
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‭

75%
+4 −0
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‭

40%
+0 −1
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‭

81%
+7 −0
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‭

71%
+3 −0
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‭

71%
+3 −0
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‭

71%
+3 −0
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‭

71%
+3 −0
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‭

66%
+2 −0
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‭

75%
+4 −0
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‭

81%
+7 −0
Collatz conjecture; Count the tries to reach $1$

Background Check out this video on the Collatz conjecture, also known as A006577. If you don't know what this is, we're given an equation of $3x + 1$, and it is applied this way: If $x$ is odd...

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

77%
+5 −0
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‭

71%
+3 −0
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‭

66%
+2 −0
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‭

77%
+5 −0
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‭

66%
+2 −0
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‭

80%
+6 −0
Digit Sum Integer Sequence (working title)

Inspired by this challenge. If anyone has any suggestions for a song title I could use for the challenge title then please leave a comment. Definition We define f(x) for a given integer as the su...

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

60%
+1 −0
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‭

75%
+4 −0
When The Ternary Is Balance

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‭

55%
+3 −2
"Hello, {name}!"

Background While we do have a "Hello, World!" challenge, we still don't have one regarding input. So let's do one! Challenge Create a program that takes an input (not as a function argument) the...

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

71%
+3 −0
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‭

66%
+2 −0
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‭

83%
+8 −0
Compute the determinant

Challenge A simple challenge: Given a two-dimensional matrix (an array of arrays) of real numbers, compute the determinant. The determinant of a matrix is a mathematical construct used in many ap...

9 answers  ·  posted 2y ago by Moshi‭  ·  last activity 1y ago by aspen138‭

61%
+6 −3
Make $2 + 2 = 5$

In this challenge, add 2 integers, but if both the integers are 2, output 5. Shortest code in each language wins! Example ungolfed program in Python 3.x def add(x, y): if x == 2 and y == 2: ...

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

71%
+3 −0
My house is destroyed! Can you make me one?

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‭

81%
+7 −0
Roll n fair dice

Challenge This is a simple randomness challenge: Given a non-negative integer $n$, and positive integer $m$, simulate rolling and summing the results of $n$ fair dice, each of which have $m$ sides...

10 answers  ·  posted 2y ago by Moshi‭  ·  last activity 10mo ago by RubenVerg‭

81%
+7 −0
In The Jailhouse Now

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

71%
+3 −0
Multiply two strings

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‭

33%
+1 −4
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‭

84%
+9 −0
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‭

60%
+1 −0
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‭

60%
+1 −0
A chunk of symbols is a calculation

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‭

85%
+10 −0
Are All Elements Equal?

Challenge Given a list of integers >= 0 , check if all of them are equal. Tests [1,1,1,1,1] -> true [0,1,1,6,7] -> false [1] -> true [] -> undefined(you do n...

16 answers  ·  posted 2y ago by Razetime‭  ·  last activity 2y ago by torres‭

81%
+7 −0
Reduce over the range [1..n]

Task I often need to find the factorial of a number or the sum of all numbers up to a number when cheating on math tests. To help me with this, your task is to write $F$, a generalized version of ...

14 answers  ·  posted 2y ago by user‭  ·  last activity 1y ago by gifti‭

77%
+5 −0
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‭

85%
+10 −0
It's Hip to be Square

Challenge A catalogue type challenge that simply asks: Given an integer n (where n>=0) as input return a truthy value if n is a perfect square or a falsey value if not. Rules You may take...

20 answers  ·  posted 2y ago by Shaggy‭  ·  last activity 2y ago by Zakk‭

71%
+3 −0
Guess the language! (Robbers' Thread)

COPS THREAD A famous cops-and-robbers challenge whose source shall remain unnamed is brought to Codidact. You are a robber. Your goal is to find answers on this link which haven't been cracked an...

12 answers  ·  posted 2y ago by AndrewTheCodegolfer‭  ·  last activity 2y ago by m90‭

77%
+5 −0
Gamer Meme Creator

Challenge You will be given a string and an ascii art as input. The string must be placed above the ascii art, and centered based on its longest line. The text BOTTOM TEXT must be placed below...

4 answers  ·  posted 2y ago by Razetime‭  ·  last activity 2y ago by user‭

77%
+5 −0
Guess the language! (Cops' Thread)

ROBBERS' THREAD A famous cops-and-robbers challenge whose source shall remain unnamed is brought to Codidact. You are a cop. You should write a program in a "famous" (has an English Wikipedia/Eso...

16 answers  ·  posted 2y ago by AndrewTheCodegolfer‭  ·  last activity 2y ago by Shaggy‭

71%
+3 −0
Three Number Monte

The Rules In this game, each round, every player faces off against every other player in a round robin format. In each match, players pick 3 positive integers that sum to 360. Let's say player 1 p...

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