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)
50%
+0 −0
Digit balanced numbers

Does a number have balanced numbers of distinct digits? That is, do the number's digits appear with equal frequency? Input A positive integer N. N will have no leading zeroes. Output An ...

3 answers  ·  posted 20d ago by trichoplax‭  ·  last activity 19d ago by m90‭

code-golf number
60%
+1 −0
Find all unique quintuplets in an array that sum to a given target

Inspiration: Leetcode's [3Sum] linkLink on CG&CC Problem Given an array nums of n (not necessarily distinct) integers, and given a target number target, return an array of all of the unique...

2 answers  ·  posted 4mo ago by CrSb0001‭  ·  last activity 1mo ago by panadestein‭

code-golf array arithmetic
50%
+0 −0
Abstract Rewriting Systems (Cops)

This is somewhat of a [proof-golf]-like [cops-and-robbers]. This is the cops' thread; the robbers' thread is here Sections: Cops Scoring What is a rewrite rule? An example An example of...

1 answer  ·  posted 5mo ago by CrSb0001‭  ·  last activity 4mo ago by CrSb0001‭

cops-and-robbers repeated-transformations grammars
75%
+4 −0
Source with the whole alphabet in order of appearance

The challenge is to write as short a source as possible, where the English alphabet (in alphabetical order from top to bottom) "abcdefghijklmnopqrstuvwxyz" is a sub-sequence of the source code. Th...

5 answers  ·  posted 6mo ago by Lundin‭  ·  last activity 6mo ago by Sylvester‭

code-golf
60%
+1 −0
Hex ​​​detector

Given an integer from 1 to 1000, indicate whether it is a centered hexagonal number[1] (also known as a hex number). What is a hex number? The hex numbers can be visualised as follows: On a he...

4 answers  ·  posted 10mo ago by trichoplax‭  ·  last activity 8mo ago by trichoplax‭

code-golf math number
50%
+0 −0
Net​​ or​​ not?

Given a hexomino, indicate whether it is a net of a cube. Input A 6 by 6 grid containing exactly 6 filled squares. The 6 filled squares will be in a single edge connected set (a hexomino). Th...

0 answers  ·  posted 9mo ago by trichoplax‭

code-golf math
66%
+2 −0
Substring factor

Does a positive integer have a substring as a factor? Input A positive integer. Output One of 2 distinct values to indicate whether the input has a factor that is a strict substring of it...

3 answers  ·  posted 10mo ago by trichoplax‭  ·  last activity 8mo ago by Shaggy‭

code-golf math number string
66%
+2 −0
Expand a greyscale/colour hex code

Consider a type of hexadecimal colour code that supports shorthand for both greyscale and colour: A 6 digit code is interpreted as 2 digits for red, followed by 2 for green, then 2 for blue. A ...

5 answers  ·  posted 3mo ago by trichoplax‭  ·  last activity 3mo ago by Shaggy‭

code-golf string
71%
+3 −0
Towers of DC .:.

DC is a reverse-Polish calculator REPL that is available on most Linux distributions. In reverse-Polish notation, you can push values to a stack and then pop those values back off to perform operat...

0 answers  ·  posted 9mo ago by Andrew Ray‭  ·  edited 9mo ago by trichoplax‭

code-golf alternative-scoring
50%
+0 −0
Awkward Ordinals

Write code that takes a positive integer and outputs the awkward ordinal name from the test cases. Notice that these are not the conventional ordinal names, although there is significant overlap. ...

0 answers  ·  posted 5d ago by trichoplax‭

code-golf number string
50%
+1 −1
Convert to Hexadecimal

Challenge Write a program that takes in a number greater than or equal to 0 and outputs its representation in hexadecimal (base 16). Examples 0 => 0 1 => 1 10 => A 15 ...

2 answers  ·  posted 13d ago by CrSb0001‭  ·  last activity 7d ago by CrSb0001‭

code-golf math base hexadecimal
50%
+0 −0
Abstract Rewriting Systems (Robbers)

This is somewhat of a [proof-golf]-like [cops-and-robbers]. This is the robbers' thread; the cops' thread can be found here. Sections: Robbers Determining a winner Robbers The cops wil...

0 answers  ·  posted 5mo ago by CrSb0001‭  ·  edited 5mo ago by CrSb0001‭

cops-and-robbers repeated-transformations grammars
80%
+6 −0
Display a Progress Bar

The goal of this challenge is simple: given a ratio of whole numbers, output a 50-character long progress bar representing the ratio. Rules Input Your program must take two numbers as input. T...

7 answers  ·  posted 6mo ago by Sylvester‭  ·  last activity 1mo ago by panadestein‭

code-golf
60%
+1 −0
Most isolated of 3 points

Given 3 points, output one that is separated from its nearest neighbour by the largest distance. Input 3 distinct points (that is, no 2 points are in the same position). Each point is a pair o...

0 answers  ·  posted 10mo ago by trichoplax‭  ·  edited 10mo ago by trichoplax‭

code-golf math number
71%
+3 −0
How many umbrellas to cover the beach?

You work at a beach. In the afternoon, the sun gets quite hot and beachgoers want to be shaded. So you put out umbrellas. When you put out umbrellas you want to shade the entire beach, with as few ...

2 answers  ·  posted 1y ago by WheatWizard‭  ·  last activity 1y ago by justhalf‭

code-golf array
66%
+2 −0
Is it a valid hidden word?

The Universal Crossword has a set of guidelines for crossword puzzle submissions. In this challenge we are going to be concerned with their rules for hidden word themes. A hidden word clue consis...

1 answer  ·  posted 1y ago by WheatWizard‭  ·  last activity 1y ago by Razetime‭

code-golf string decision-problem
75%
+4 −0
Is it stuck in a counting loop?

Given a list of non-negative integers the function $f$ replaces every integer with the number of identical integers preceding it (not necessarily contiguously). So f [1,1,2,2,1,3,3] = [1,2,1,2,3,1...

1 answer  ·  posted 1y ago by WheatWizard‭  ·  last activity 1y ago by isaacg‭

code-golf decision-problem list
83%
+8 −0
The 50 substrings that validate any string of Roman numerals

Given a string of Roman numerals, decide whether it forms a valid Roman number. If not, output the substring that proves this, from the list of 50 strings described below. Relevant fact This chal...

7 answers  ·  posted 1y ago by trichoplax‭  ·  edited 6mo ago by trichoplax‭

code-golf math number string
75%
+4 −0
Fibonascii Squares

The Challenge Your job is to, given input positive non-zero integer $n$, output an ASCII representation of the tiled Fibonacci squares up to the $n$th number of the Fibonacci sequence. Rules Inp...

2 answers  ·  posted 10mo ago by Sylvester‭  ·  edited 10mo ago by Sylvester‭

code-golf ascii-art fibonacci
71%
+3 −0
Single digit Roman numeral

Given a single character, which is a valid Roman numeral, output its value. Values There are 7 valid single character Roman numerals, with the following values: Character Value I...

6 answers  ·  posted 1y ago by trichoplax‭  ·  last activity 11mo ago by xrs‭

code-golf
71%
+3 −0
12-hour time is weird

Your mission for today, should you choose to accept it, is to write a simple 12-hour clock calculator. Your input will always be in the form of arg op arg, where op is either + or -, and arg is eit...

0 answers  ·  posted 1y ago by honnza‭

code-golf
62%
+3 −1
Print the modular multiplicative inverse / virtual fractions

Goal Print the modular multiplicative inverse with a modulus of 65536 (or a higher exponent of 2) for odd numbers 1-97. Example output Print these values (or an extension of them): 1 43691 52...

2 answers  ·  posted 1y ago by H_H‭  ·  last activity 22d ago by CrSb0001‭

code-golf math
66%
+2 −0
Construct the Irish possessive

In this challenge you will take an Irish word and a personal pronoun and create the possessive pronoun construction combining the two. For example sé, madra becomes a mhadra. Translated to English...

1 answer  ·  posted 1y ago by WheatWizard‭  ·  last activity 1y ago by Arpad Horvath‭

code-golf natural-language
60%
+1 −0
Reverse engineer the colors for a layout.

At my job we have to sometimes lay out materials. Materials come in large long rolls and are cut into smaller pieces when being laid out. When we order the rolls we draw up a layout document which...

0 answers  ·  posted 1y ago by WheatWizard‭

code-golf
50%
+0 −0
Multiplicative perfection

Given a positive integer, indicate whether it is the product of its proper divisors. Integers equal to the product of their proper divisors can be found on the Online Encyclopedia of Integer Seque...

4 answers  ·  posted 7mo ago by trichoplax‭  ·  last activity 7mo ago by celtschk‭

code-golf math number decision-problem
60%
+1 −0
How many odd digits?

Given a positive integer, count its odd digits. Input An integer from 1 to 999,999,999, inclusive, in any of the following formats: A number (such as an integer or floating point number), li...

6 answers  ·  posted 8mo ago by trichoplax‭  ·  last activity 6mo ago by Shaggy‭

code-golf number
66%
+2 −0
Find near miss prime multiples.

Given a number $n \geq 3$ as input output the smallest number $k$ such that the modular residues of $k$ by the first $n$ primes is exactly $\{-1,0,1\}$. That is there is a prime in the first $n$ p...

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

code-golf number-theory
66%
+2 −0
Round trip stones

$N$ vessels initially contain $3$ stones each. What is the probability of having at least $3$ stones in the first vessel after moving a uniformly random selection from the first vessel to the secon...

1 answer  ·  posted 1y ago by trichoplax‭  ·  last activity 12mo ago by Arpad Horvath‭

code-golf math number probability
22%
+0 −5
HOW TO HANDLE THIS ERROR: "Failed to get input map for signature: serving_default" [closed]

import requests import json import numpy as np import base64 import cv2 Replace this with the actual image path you want to test image_path = 'H_L_.jpg' Read and preprocess the image image ...

0 answers  ·  posted 1y ago by mjkatre18‭  ·  closed 1y ago by Mithical‭

tensorflow tensorflowserving postapi deeplearning cnn
57%
+2 −1
Fibonacci without consecutive digits

Output the Nth number in the list of Fibonacci numbers that have no consecutive digits. Input A non-negative integer (if you treat the Fibonacci numbers as zero-indexed) or a positive integer (...

4 answers  ·  posted 1y ago by trichoplax‭  ·  last activity 7mo ago by Andrew Ray‭

code-golf math number sequence fibonacci
75%
+4 −0
Probability of rolling all 6 dice faces

The probability of rolling every number from 1 to 6 with $N$ six-sided dice. Input A positive integer $N$. Your code must work for inputs up to and including 10, but may crash, error, or give ...

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

code-golf math dice
57%
+2 −1
Give the fool's fibonacci sequence

Recently I asked for tips on improving some code-golf of mine. The code was supposed to output every third value of the Fibonacci sequence starting with 2: 2,8,34,144,610,2584,10946,46368,196418,...

2 answers  ·  posted 1y ago by WheatWizard‭  ·  last activity 10d ago by CrSb0001‭

code-golf sequence open-ended-function fibonacci
66%
+2 −0
Can I follow this recipe?

You work in a kitchen which has a peculiar rule. When you mix something into a pot you must always add at least one new ingredient. So you can add pasta, oil, salt then pesto, but not pasta, pesto...

1 answer  ·  posted 1y ago by WheatWizard‭  ·  last activity 1y ago by isaacg‭

code-golf decision-problem
71%
+3 −0
Borromean coprimes

Given 3 positive integers, indicate whether they are Borromean coprimes. Definition 3 positive integers are called Borromean coprimes if both of the following are true: Their greatest common d...

5 answers  ·  posted 1y ago by trichoplax‭  ·  last activity 1mo ago by panadestein‭

code-golf math
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 2y ago by WheatWizard‭  ·  edited 2y ago by WheatWizard‭

code-golf polyominos
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 2y ago by WheatWizard‭  ·  last activity 2y ago by Shaggy‭

code-golf string
60%
+1 −0
Word suggesting

Suggest a word from a word list, given a string. Motivation Imagine typing a word one letter at a time, and seeing a suggested word after each letter is typed. At first the suggested word is simp...

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

code-golf string list
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 2y ago by WheatWizard‭  ·  last activity 2y ago by TheCodidacter, or rather ACodidacter‭

code-golf list array
71%
+3 −0
Plain black webpage

This is a language specific challenge, for HTML only. Your answer is the content of a self contained HTML file, that when opened in a web browser gives a plain black page. Requirements The HTM...

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

code-golf internet html
66%
+2 −0
Reverse the bits in a Byte

Simple challenge: Read a byte, swap bit 7 with 0, 6 with 1, 5 with 2 and 4 with 3 and then output the byte. For example the byte 0b1001'1100 would turn into 0b0011'1001. Rules: Shortest code wi...

6 answers  ·  posted 1y ago by H_H‭  ·  last activity 1y ago by lovebuny‭

code-golf
60%
+1 −0
Shortest representation in generalised Roman numerals

Find the shortest representation of an integer in generalised Roman numerals. Since there is more than one way to generalise, only the following definition applies to this challenge. Definition T...

1 answer  ·  posted 1y ago by trichoplax‭  ·  last activity 1y ago by NikNakk‭

code-golf number
66%
+2 −0
Is it part of the mandelbrot set?

Input is a number, you have to decide if it is part of the mandelbrot set or not, after at least 16 iterations. This is done by applying this formula: $z_n = z_{n-1}^2 + c$ repeatedly. $c$ is the ...

2 answers  ·  posted 1y ago by H_H‭  ·  last activity 22d ago by CrSb0001‭

code-golf
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 2y ago by WheatWizard‭

code-golf polyominos
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 2y ago by WheatWizard‭  ·  last activity 2y ago by WheatWizard‭

code-golf string regex
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 emanresu A‭

code-golf alphabet binary
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‭

code-golf string decision-problem
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‭

code-golf quine base
60%
+1 −0
I irradiate your source code, you irradiate your output

Your task is to write a program $p$ which outputs a string $s$ with the same length as $p$, where $s \neq p$. If I remove the $n$th byte from your program to get program $q$, then either $q$ outpu...

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

radiation-hardening
71%
+3 −0
Label a hinged tetromino

Given a hinged tetromino, give it a unique, consistent label independent of location, rotation, and reflection. Tetrominoes A tetromino is a connected subset of the square tiling, composed of 4 s...

2 answers  ·  posted 2y ago by trichoplax‭  ·  last activity 2y ago by RubenVerg‭

code-golf polyominoes
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 2y ago by WheatWizard‭  ·  edited 2y ago by WheatWizard‭

code-golf string abstract-algebra