All Questions

Filter by
Sorted by
Tagged with
0
votes
2answers
73 views

Is this a rectangle? [closed]

The challenge: Given four coordinates, each in x y form, your job is to find out whether or not the given coordinates form a rectangle, and output a truthy/falsey. Rules: For the sake of simplicity,...
11
votes
26answers
394 views

Triangular code, triangular output

For this challenge, submissions should be a program or function shaped like a right triangle, which produces a right triangle of the same size. What is a right triangle? For this challenge, a right ...
16
votes
19answers
750 views

Convert to and from Base 94

The challenge Make 2 programs which convert decimal to and from base 94, or a bidirectional program. Base 94? Base 94 is like any other base, but instead of 0 to 9 and letters, it uses ASCII ...
20
votes
7answers
384 views

Maintain diagonal symmetry when placing N items on a square grid

Write a program that takes in two non-negative integers S and N in that order. S represents the side length of a square grid of . characters. N represents the ...
3
votes
0answers
71 views

Decode Arabic to Arabic Presentation Form

Objective Given an Arabic string consisting of ISO/IEC 8859-6 Arabic letters (U+0621–063A, 0640–064A), decode it to Arabic Presentation Forms-B (U+FE70–FEFF). Behavior of Arabic letters ISO/IEC ...
23
votes
15answers
929 views

Check membership of an infinite list

As input you will receive An integer \$a\$ A list of integers that is infinite and strictly-monotonic1. Your program should check in finite time if \$a\$ appears the list. You should output one of ...
-7
votes
0answers
85 views

The uncrackable cipher [closed]

I ran this through reddit yesterday and nobody could figure it out. I honestly don't know what the original text is. I originally received this in a body of an email. This is a temporary account, but ...
12
votes
3answers
621 views

Code golf edit distance 2

The edit distance between two strings is the minimum number of single character insertions, deletions and substitutions needed to transform one string into the other. This task is simply to write ...
2
votes
7answers
184 views

Does base n have any Rotate-Left-Double numbers?

Task A Rotate-Left-Double number in base \$n\$ is a number \$m\$, when its base-\$n\$ digits are rotated left once, equals \$2m\$. The base-\$n\$ representation of \$m\$ cannot have leading zeros. ...
12
votes
5answers
675 views

Boil eggs using hourglasses

These are the classical puzzles: You need to boil eggs for exactly 9 minutes, or else the visiting Duchess will complain, and you will lose your job as head chef. But you have only 2 ...
9
votes
3answers
328 views

Multiplayer Rock-Paper-Scissors

Objective Given a nonempty multiset of Rock, Paper, and Scissors, output the winning figure ...
14
votes
19answers
1k views

Mirror and reverse text

Inspired by I reverse the source code, ... Your task, if you wish to accept it, is to reverse text and mirror select characters. Yes, yes, I know. Very surprising. Input A string, ...
26
votes
34answers
5k views

How happy is this emoticon?

In this challenge, submissions will be programs or function which, when given an emoticon such as :-), :(, or ...
24
votes
12answers
5k views

Is this a legal date? - April Fools' edition

Task A date can be compactly represented in a 6-character string in the format ddmmyy where the first two characters (dd) ...
18
votes
13answers
2k views

Let's decompress a bit

Given a compressed string \$s\$ made of printable ASCII characters (32 to 126), your task is to print or return the original text by applying this simple decompression algorithm: Start with \$k=0\$ ...
15
votes
14answers
1k views

Generating generating expressions for sequences

(yes, "generating generating" in the title is correct :) ) Context In middle (?) school we are taught about sequences and, in particular, we are taught about linear sequences where the ...
19
votes
13answers
1k views

Convert Planck unit to SI metric

Objective Given a dimension of an SI unit, convert the Lorentz-Heaviside version of a Planck unit \$1\$ into SI metric. What is a Planck unit? Planck units are a set of units of measurement. It ...
35
votes
13answers
6k views

God is real . . . unless declared integer

This challenge is inspired by Fortran's idiosyncratic implicit typing rules. Your task will be to determine the data type of the object GOD according to the ...
9
votes
20answers
535 views

KoTH: Wizard Battle

In this challenge, all bots are wizards. At the beginning of each round, they create a wand which has a certain chance of successfully stunning another wizard. They then fight, by choosing one bot to ...
12
votes
14answers
2k views

Pseudo-deterministic number generator

Task Write a function/full program that will be able to produce two different sequences of integers in [0, ..., 9]. You will take an input ...
26
votes
6answers
4k views

Draw an ASCII oak tree (or a woman with curly hair?)

Task Your task is to draw these beautiful oak trees: ...
23
votes
18answers
2k views

Cook me a character meal

Chef Avillez is about to cook us some really nice meal. He is just waiting for us to give him some ingredients and to request a meal. Task Given a list of ingredients (strings matching ...
5
votes
0answers
182 views

2D interpolation

Given required values for an expression with 2 variables, output a short expression which fulfill these values Input You may take the input in any reasonable format, e.g. ...
-4
votes
16answers
242 views

Hello ASCII World!

Construct a full program which outputs Hello, World!. The score of your submission will be equal to the sum of all of the ASCII values of the distinct characters. ...
14
votes
4answers
844 views

Reconstruct a 3d arrangement of cubes from two of its projections

Setup Take the following 4x4x4 cube along with a 2D view of 3 of its faces, with a common 1x1x1 cube highlighted: The arrows ...
10
votes
10answers
680 views

Find how many ordered pairs of integers share only one digit

Task Your task is to make the smallest function/program that can, when gives an number N, return/print: the number of possible choices a, b such that \$1 \leq a &...
23
votes
21answers
2k views

Four distinct 8-bit integers

Submit a well-formed program or function with usual I/O rules which satisfy the input, output, and algorithm conditions below. Shortest submission (in bytes) wins. As always, standard loopholes are ...
17
votes
20answers
2k views

Pendulum Encoding

Given a string as an input (which can be any acceptable/convenient format in your language), implement pendulum encoding. The test cases are split into individual items (which aren't quoted) for a ...
12
votes
9answers
525 views

Simulate D Flip-Flop

Objective Simulate an edge-triggered D Flip-Flop. What is D Flip-Flop? A D flip-flop is an electronic digital device that outputs an inputted data (abbr. D) with synchronization to a clock (abbr. ...
3
votes
26answers
562 views

Add N numbers without using + or -

Given N integers, output the sum of those integers. Input You may take the integers in any reasonable format, including: stdin arguments an array or list Rules ...
-4
votes
0answers
83 views

wasting n-dimensional peanut butter

I was scraping the last peanut butter out of the jar during the Covid19 pandemic, and wondering how much of the good stuff was left down inside the jar, inaccessible but for the most desperate ...
21
votes
33answers
2k views

Vowels up, consonants down

Challenge You will be given a string that can contain lowercase letters, uppercase letters, or spaces. You have to turn the vowels (a, e, i, o, u) in the string to upper case and consonants to lower ...
9
votes
4answers
263 views

Counting valid Binary Sudoku boards

Sequel of Counting valid Binary Sudoku rows. Background Binary Sudoku, also known as Takuzu, Binario, and Tic-Tac-Logic, is a puzzle where the objective is to fill a rectangular grid with two ...
12
votes
4answers
399 views

Solving the water bucket riddle!

Context The water buckets riddle or the water jugs riddle is a simple riddle that can be enunciated in a rather general form as: Given \$n > 0\$ positive integers \$a_1, a_2, \cdots, a_n\$ ...
12
votes
26answers
2k views

Filter an array so that duplicate items are removed

In the shortest amount of code in any programming language, filter out the duplicate items in an array of which the order is irrelevant. Here are some test cases: ...
15
votes
10answers
1k views

Shortest total non-primitive recursive function

Natural numbers ≡ \$\mathbb{N}≡\{0,1,2,...\}\$ The submission can be either a program or a function, both cases will henceforth be referred to as "function". The task is to golf the shortest ...
1
vote
0answers
81 views

Minimum Hop Count in Directed Graph based on Conditional Statement [closed]

A directed graph G is given with Vertices V and Edges E, representing train stations and unidirectional train routes respectively. Trains of different train numbers move in between pairs of Vertices ...
26
votes
26answers
2k views

Measure the lengths of binary patterns

Let's consider the sequence of the binary representation of positive integers (without any leading zero): ...
21
votes
19answers
4k views

Even a clock that isn't working gets the time right two or three times a day

Context When I was a little kid, I watched a Disney movie where Goofy told his son "Boy, even a broken clock is right two or three times a day." (see this youtube clip, courtesy of @Arnauld). ...
2
votes
1answer
116 views

Tips for Golfing in Symja

Symja is a "computer algebra language & Java symbolic math library for Android NCalc calculator". It's a fun little language, so I'm wondering if y'all have any tips for golfing in Symja. As per ...
4
votes
2answers
80 views

Tips for golfing in Pure Data

Pure data is a graphical programming language designed for audio processing. This makes it unsuitable for most general programming but especially unsuitable for code-golf. It would then be nice to ...
15
votes
12answers
1k views

Day of the week of an ambiguous date

Goal Write a program or function that returns the day of the week for a date, eg. 01/06/2020 -> Mon However, it's unknown if the date is in the format mm/...
13
votes
12answers
1k views

KoTH: Highest HP is Eliminated!

In this challenge, bots must survive as long as possible. In each turn, the bot with the most HP is eliminated. This challenge is inspired by the Smallest unique number KoTH. Results After 100,000 ...
40
votes
28answers
4k views

Name your novel disease

Introduction The current coronavirus disease is officially named COVID-19, from the 3 words corona virus disease, and the year 2019. (Technically it's coronavirus, making 2 words, but whatever...) ...
12
votes
5answers
278 views

Return a word with a prescribed sum of letters

Identify each letter of the English alphabet with the number denoting its position in the alphabet, that is, a = 1, b = 2, c = 3, ..., z = 26 (no distinction ...
18
votes
22answers
2k views

A bit of a digital XOR

Here are the first 100 numbers of a sequence: ...
17
votes
4answers
427 views

What can you see on a hexagonal spiral?

This code-golf challenge will have you computing OEIS sequence A300154. Consider a spiral on an infinite hexagonal grid. a(n) is the number of cells in the part of the spiral from 1st to n-th cell ...
24
votes
23answers
3k views

Ah, why is there a bug in my program?

This challenge is inspired by @LuisMendo's MATL answer to my "binary multiples" challenge. Task Pick a code-golf challenge that is open and that has been posted before this one; let me call it the "...
23
votes
58answers
2k views

Numbers by Position

Numbers by Position Challenge Print the numbers: 1 22 333 4444 55555 666666 7777777 88888888 999999999 In that order. I/O Takes no input. The numbers can ...
13
votes
20answers
707 views

Quotes around sequence of chars

Challenge Your goal is to write a function that puts quotes around a sequence of capital letters in a string. So some examples (everything on the left (before function) and right (after function) ...

15 30 50 per page
1
2 3 4 5
227