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)
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 3y ago by Moshi‭  ·  last activity 1y ago by RubenVerg‭

66%
+2 −0
Prove commutativity on this monoid presentation.

Given two binary strings $A$ and $B$ such that $A$ is an anagram of $B$, output a third binary string $S$ such that both $A$ and $B$ can be created by iterated removals of the substring $10101$ fro...

0 answers  ·  posted 1y ago by WheatWizard‭

75%
+4 −0
Calculate the Z-array

Task Given a list of numbers $X$ produce a second list of numbers $Y$ such that $Y_i$ is the length of the longest common prefix of $X$ and $X$ with the first $i$ elements removed. For example if...

1 answer  ·  posted 1y ago by WheatWizard‭  ·  last activity 1y ago by TheCodidacter, or rather ACodidacter‭

87%
+12 −0
Cumulative Counts

Challenge Given an array of numbers return the cumulative count of each item. This is the number of times an item has occurred so far. Examples [1,1,2,2,2,1,1,1,3,3] -> [1,2,1,2,3,3,4,5,1,2]...

19 answers  ·  posted 3y ago by rak1507‭  ·  last activity 1y ago by WheatWizard‭

66%
+2 −0
Build a replacement ball in regex.

In this challenge you will take a number $n$ and a string $X$ of length $\geq n$, and produce a regular expression which matches all strings that are withing $n$ character substitutions of $X$. Sp...

3 answers  ·  posted 1y ago by WheatWizard‭  ·  last activity 1y ago by WheatWizard‭

66%
+2 −0
Are these reduced forms of the same thing?

Task You are going to take three strings as input $A$, $B$ and $X$. And your goal is to determine if there exists a third string $S$ such that both $A$ and $B$ can be formed by iteratively removin...

0 answers  ·  posted 1y ago by WheatWizard‭  ·  edited 1y ago by WheatWizard‭

81%
+7 −0
Efficient censorship

You are a low-level censor working for the Ministry of Media Accuracy. Part of your job is to make sure that certain words don't appear in publications. Every morning you get a fresh stack of next...

4 answers  ·  posted 1y ago by WheatWizard‭  ·  last activity 1y ago by Shaggy‭

66%
+2 −0
Connect the corners without 4 in a row

Connect opposite corners of a rectangle of characters without putting 4 characters in a row. Input Two numbers, W and H, representing the width and height of the rectangle Each number will be ...

1 answer  ·  posted 2y ago by trichoplax‭  ·  last activity 1y ago by WheatWizard‭

66%
+2 −0
Determine if a polyomino is "prime"

An $n$-polyomino is a connected subset of the square tiling consisting of $n$ squares. We will not require that polyominos be simply connected, that is they can have holes. We will say a $n$-polyo...

1 answer  ·  posted 1y ago by WheatWizard‭  ·  edited 1y ago by WheatWizard‭

66%
+2 −0
Count polyomino bisections

An polyomino is a non-empty connected subset of the square tiling consisting of squares joined along their edges. We will not require that polyominos be simply connected, that is they can have hole...

0 answers  ·  posted 1y ago by WheatWizard‭

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 3y ago by Moshi‭  ·  last activity 1y ago by aspen138‭

75%
+4 −0
Decoding a non injective bit matrix encoding

The problem Someone has created an encoding format for square bit matrices, however they have found it isn't perfect! One encoding may not decode to exactly one matrix, or it may not even be possi...

0 answers  ·  posted 1y ago by Aftermost2167‭  ·  edited 1y ago by Aftermost2167‭

71%
+3 −0
8 coexisting queens

This is a fixed output challenge. Output a textual representation of a chessboard hosting 8 queens, none of which are attacking each other. There are 92 ways of arranging them, 12 if rotations and...

5 answers  ·  posted 2y ago by trichoplax‭  ·  last activity 2y ago by m90‭

71%
+3 −0
Mediocre pop count

Given a sequence of letters, omit those with the highest or lowest pop count. Terminology The pop count or population count of a binary string is the number of 1s in it. For this challenge, the ...

6 answers  ·  posted 2y ago by trichoplax‭  ·  last activity 2y ago by A username‭

75%
+4 −0
Encode with ROT13.5

Given a string, convert all of its letters using ROT13, and all of its digits using ROT5. This is sometimes referred to as ROT13.5. Input A sequence of printable ASCII characters (character cod...

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

66%
+2 −0
Digit antitranspose

Convert a matrix or grid of digits to its antitranspose. For a square matrix , this is its reflection in its antidiagonal. More generally, for a rectangular matrix, this is its reflection in its sk...

4 answers  ·  posted 2y ago by trichoplax‭  ·  last activity 2y ago by torres‭

75%
+4 −0
Just the vowels please

Given a sequence of letters, output only the vowels. Input A sequence of letters This may be a string or any ordered data structure of characters (provided it is consistent between inputs) Th...

9 answers  ·  posted 2y ago by trichoplax‭  ·  last activity 2y ago by taoh‭

50%
+0 −0
Circle of text characters

Given a radius R, output a text representation of a circle. Input A positive integer R (strictly greater than zero) You do not need to handle values of R greater than 32 Output A square ...

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

66%
+2 −0
Pinwheel ​words

Given a word that can be rotated by 180 degrees (a half turn) about at least one of its 3 axes and continue to be composed of English alphabet letters, output one of its rotated forms. The 3 rotat...

0 answers  ·  posted 2y ago by trichoplax‭

60%
+1 −0
Balanced quinary quasiquine

Given an integer $N$ in balanced quinary, output the first $N$ characters of your source code if $N$ is positive, or the last $-N$ characters of your source code if $N$ is negative. Terminology ...

1 answer  ·  posted 2y ago by trichoplax‭  ·  edited 2y ago by trichoplax‭

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

81%
+7 −0
Word Set Square

Challenge Given a string, e.g. Hello, do the following: Mirror it: Hello -> HelloolleH and create a right triangle using it as the sides: H ee l l l l o...

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

71%
+3 −0
The holeyest base

Given a positive integer as input, indicate which base from 2 to 16 gives the most holes in the representation of the input in that base. The digits used are 0123456789ABCDEF. Note that these incl...

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

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

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 3y ago by celtschk‭  ·  last activity 2y ago by Shaggy‭

60%
+1 −0
Chequer checker

A chequer board (also spelt "checker board" in some places) is an 8 by 8 grid of squares alternating between 2 colours. Check whether a provided pattern could be a region of a chequer board. The c...

1 answer  ·  posted 2y ago by trichoplax‭  ·  edited 2y ago by trichoplax‭

71%
+3 −0
Presumptuous base conversion

Take an input string representing a number and convert it to decimal (base 10). However, the base of the input is not specified. Assume the input is in the smallest base for which its digits are va...

5 answers  ·  posted 2y ago by trichoplax‭  ·  last activity 2y 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 2y ago by Moshi‭

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 2y ago by Shaggy‭

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

66%
+6 −2
Multiply complex numbers.

Multiply complex numbers. 2 space-seperated ones will be input, as follows: (update: you can replace i with j or some other symbol if needed) a+bi -a+bi a-bi -a-bi where a and b are integers ...

7 answers  ·  posted 3y ago by heav‭  ·  last activity 2y ago by __blackjack__‭

87%
+12 −0
Partial Sums of Harmonic Series

Given an positive integer $n$, return the least positive integer $k$ such that the $k$th partial sum of the harmonic series is greater than or equal to $n$. For example, if $n = 2$, then $k = 4$, b...

11 answers  ·  posted 4y ago by Quintec‭  ·  last activity 2y ago by south‭

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 3y ago by user‭  ·  last activity 2y ago by gifti‭

81%
+7 −0
Evens or Odds - you know this one

Get ready for a comparatively dry question - this is intended to be one of the "the"s of the code-golfing dictionary. Create a program which inputs a base 10 non-negative whole number (without lea...

16 answers  ·  posted 3y ago by AndrewTheCodegolfer‭  ·  last activity 2y ago by Olin Lathrop‭

83%
+8 −0
Golf a FRACTRAN interpreter

Description From the Esolangs wiki, In Fractran, a program consists of a finite list of positive, rational numbers. The input to a program is a positive integer n. The list is then searched ...

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

77%
+5 −0
A number adder, not a death adder

Create a program P1 which takes as input a base 10 number N1 (the numbers for the variables are important). Given N1, P1 will print a program P2. P2 will take as input a base 10 number N2 and outpu...

14 answers  ·  posted 3y ago by AndrewTheCodegolfer‭  ·  last activity 2y ago by torres‭

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

83%
+8 −0
Solve Goldbach's Conjecture

Goldbach's Conjecture states that every even whole number greater than 2 is the sum of 2 prime numbers. Your task is to return those 2 prime numbers, given an even whole number as input. There are ...

10 answers  ·  posted 4y ago by Quintec‭  ·  last activity 2y ago by torres‭

75%
+4 −0
The Pell Numbers

Introduction The Pell(no, not Bell) Numbers are a simple, Fibonacci-like sequence, defined by the following relation: $P_n=\begin{cases}0&\mbox{if }n=0;\\1&\mbox{if }n=1;\\2P_{n-1}+P_{n-2...

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

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‭

81%
+7 −0
Word Count Tool

In Google Docs, the word count tool looks like this: Pages would not make sense, but your goal is to implement every other count. Definitions Words are strings of text separated by any amount ...

9 answers  ·  posted 3y ago by Quintec‭  ·  last activity 2y ago by torres‭

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

80%
+6 −0
Write a Deadfish Interpreter

A rewrite of this SE question with a simpler input format and guidelines. Challenge Deadfish uses a single accumulator, on which all commands are to be performed. It has the following commands: ...

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

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 3y ago by Shaggy‭  ·  last activity 2y ago by Zakk‭

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

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

80%
+6 −0
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 4y ago by Adám‭  ·  last activity 3y ago by south‭

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

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

77%
+5 −0
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 3y ago by radarek‭