All Questions

Filter by
Sorted by
Tagged with
9
votes
4answers
483 views

When is Hannukah?

Input The input will be a year between 1583 and 2239. We just want to know when Hannukah was or will be in that year. This is information used by millions of people every year and put in calendars ...
30
votes
22answers
3k views

Generate a Nine-Ball Pool rack

Introduction Nine-Ball is a popular pool game played casually and as a competitive sport. There is one of each numbered ball, with the numbers 1 to 9. The game starts with all 9 of the balls in a ...
2
votes
3answers
185 views

Partial tq interpreter

In this task you are expected to provide a list output given an input tq program. The tq programs will not contain whitespace inside them. What is tq, in the first place? tq is a lazy-evaluated ...
14
votes
9answers
402 views

Partitioning Digits into Distinct Integers

Given a sequence of base-10 digits, output the longest list of integers that contains all the digits exactly once, in the order in which they appeared in the input, without repeating any integers. ...
9
votes
10answers
376 views

Integer Keys and Duplicates

Given a non-empty list/vector of positive integers, write a function to check the following conditions in as few bytes as possible. Take the first integer (the key, or k1) and check that the next k1 ...
9
votes
1answer
372 views

Caddyshack or: How to compress already-golfed code

In golf, a knowledgable caddie helps an already good golfer to be even better. In this challenge, you build a "caddie" to help you code golf. In particular, your caddie will compress golfed code in ...
-2
votes
2answers
231 views

Shorten String as Much as Possible [closed]

Introduction In a list of strings, there is a certain length you can shorten strings to before they become indistinguishable. This is a pretty bad explanation, so here is an example. ...
11
votes
9answers
675 views

Random spanning tree of a rectangular grid

Significantly harder version of Spanning tree of a rectangular grid. Background A spanning tree (Wikipedia) of an undirected graph is a subgraph that is a tree which includes all of the vertices of ...
23
votes
11answers
1k views

Random triple with uniform marginals

Output a random triple \$(x,y,z)\$ of real numbers such that \$x+y+z=\frac{3}{2}\$ Each of \$x,y,z\$, taken alone, is uniformly distributed from \$0\$ to \$1\$. Please explain in your answer what ...
10
votes
4answers
1k views

Can you calculate the average Levenshtein distance exactly?

The Levenshtein distance between two strings is the minimum number of single character insertions, deletions, or substitutions to convert one string into the other one. The challenge is to compute ...
0
votes
1answer
179 views

Determine if a number is less than another [closed]

Introduction Your job is to write a function or program that detects if a number a is less than a number b. But... You are not ...
8
votes
4answers
762 views

Polyglot self-interpreter time

Your task is to make a program which interprets the language it is run in, but also works in many languages. Let's say you make a Brainfuck-Underload self-interpreglot, as it will be called. Run in ...
5
votes
3answers
335 views

Swaps to Sort an Array

You are given an array \$A\$, which may contain duplicate elements. In each swap, you may swap the value of any two indices \$i, j\$ (i.e. switch the values of \$A_i\$ and \$A_j\$). What is the least ...
3
votes
1answer
188 views

How Shuffled is this Sequence?

Given a sequence \$S\$ with length \$n\$ of exactly one each of whole numbers from \$1\$ to \$n\$, your task is to return a number \$\sigma\$ indicating how shuffled it is. Definition of shuffledness ...
6
votes
1answer
532 views

Average number of strings with Levenshtein distance up to 3

The Levenshtein distance between two strings is the minimum number of single character insertions, deletions, or substitutions to convert one string into the other one. Given a binary string \$S\$ of ...
27
votes
37answers
2k views

CahartcreS awppnig (Character Swapping)

Intro/Background I was looking at "You Had One Job" pictures lately, and noticed an old favourite of mine: And I said to myself: "I need a program that can generate text like that". So I devised a ...
9
votes
1answer
244 views

Maximal 2-distance Sets

In the plane (\$\mathbb R^2\$) we can have at most five distinct points such that the distances from each point to every other point (except itself) can assume at most two distinct values. An example ...
28
votes
15answers
4k views

.-…--..---.-…--… the red-nosed reindeer

Can you recover a sequence of letters from a sequence of dots and dashes? In Morse code, x is represented by -..-, but without ...
14
votes
1answer
424 views

Is this ordinal prime?

You are given an countable ordinal \$1 < r < \varepsilon_0\$. Determine whether or not it is prime. If not, provide exactly two ordinals \$r_0, r_1 < r\$ such that \$r_0r_1 = r\$, following ...
4
votes
3answers
364 views

Minified Intcode Computer

As the trip through the solar system on your way to rescue Santa gets a little droll, so perhaps some optimizations to your Intcode Computer are in order. Namely, making it as small as possible ...
4
votes
11answers
730 views

Reversing and Shifting

Sandbox Adapted from exercise 8 of 100 little Keg exercises String manipulation is a very important part of any programming language. Consequently, that is what this challenge is about. The ...
8
votes
11answers
508 views

Convert Character Substrings to Numeric

I often have to take character data and categorize it numerically at work. A common thing I do is to take character type variables and convert them to numeric type characters, keeping same categories ...
18
votes
9answers
1k views

Proportion of self-avoiding walks on a square lattice

The challenge Given a positive integer N, compute the proportion of N-step walks on a plane that don't intersect themselves. ...
2
votes
1answer
128 views

From text to ascii art from CodinGame practice puzzle

On CodingGame, there is a Puzzle that ask to write words with ascii art. I solve the puzzle then tried to golf it. What improvement can I do on it? ...
12
votes
13answers
2k views

Probabilistically fair prize splitting for two-player coin toss

Introduction Adam (A) and Bubbler (B) are playing coin toss, where the one who wins 5 times first would win the prize of $32. If the game is aborted when the scores are ...
7
votes
4answers
364 views

Dirichlet Convolution Inverse

If \$f,g\colon \mathbb{Z}_{\geq 1} \to \mathbb{R}\$, the Dirichlet convolution of \$f\$ and \$g\$ is defined by \$ \qquad\qquad\qquad \displaystyle (f*g)(n) = \sum_{d|n}f(d)g(n/d).\$ This ...
4
votes
1answer
109 views

Is there a shorter way to express this haskell idiom?

Every so often I have a function of type a -> b and a function of type b -> b -> c and I would like a function of type <...
3
votes
11answers
793 views

Even-Odd chunks

(Inspired by the Keg utility of this challenge) Given a non-empty input string, e.g. s c 1= e(a"E"), split the input into even-odd chunks. Example (Feel free to ...
0
votes
2answers
128 views

Is there any web esoteric language(like javascript)? [closed]

Is there any javascript-like language? Something that can be interpreted by browsers?
11
votes
5answers
609 views

Define the finite field GF(9)

\$GF(9)\$ or \$GF(3^2)\$ is the smallest finite field whose order isn't a prime or a power of two. Finite fields of prime order aren't particurlarly interesting and there are already challenges for \$...
1
vote
1answer
89 views

2D Path Drawing [duplicate]

(This is not a duplicate of Follow the path, as this challenge have invalid path detection and use ><^v in the output.) Task So your task is to take in the ...
15
votes
22answers
2k views

Integer Interpretator

The Challenge Given a finite list of integers, split it into the fewest partitions possible such that no partition contains a number more than once. Rules Input can be in any format and any order. ...
12
votes
14answers
630 views

Linear dependences over the field with two elements

The \$d\$-dimensional vector space \$\mathbb{F}_2^d\$ over the field with two elements \$\mathbb{F}_2\$ is the set of vectors of \$d\$ bits. Addition of vectors is bitwise xor. A linear dependence is ...
5
votes
4answers
306 views

Play flip--flop

Flip flop is a memory / arithmetic game that I played in high school. Some number of players stand in a circle. The players take turns. On the nth turn, the current ...
0
votes
0answers
46 views

Print the twelve days of Christmas [duplicate]

The goal is simple, print out each day of the twelve days of Christmas, the text should match this exactly ...
5
votes
2answers
191 views

Two stack sorting

This challenge is inspired by the same task I read some time ago in CACM. There are many ways to sort stuff. Most attempt to sort in as few operations as possible (= as fast as possible). However, it ...
7
votes
3answers
375 views

Decode ascii and reversed words sentence

In a challenge of CodingGame, there is a challenge that ask you to decode a string composed by reversed words ('Hello world' > 'olleH dlrow') then each characters converted into ascii value separeted ...
22
votes
25answers
3k views

Even and Odd Numbers

Sandbox Adapted from exercise 4 of 100 little Keg exercises The ability to repeat chunks of code within a program is an important part of any programming language. Also just as important is the ...
16
votes
10answers
1k views

Fill the Golfeek gutter

Golfeek is the working name of an esolang I'm occasionally working on. One distinctive feature of this language is that each statement is encoded as a sequence of bits rather than a sequence of bytes. ...
9
votes
1answer
691 views

Make a Lost Compass

Lost is a 2-Dimensional programming language where the instruction pointer starts at a random location, moving in a random direction. A description of the language can be found at the bottom of the ...
9
votes
0answers
158 views

Compare Dowker Knotation

Dowker notation is a common way of representing mathematical knots. Dowker notation can be derived from a knot diagram in the following way (based on the description from the wikipedium): We will ...
3
votes
1answer
379 views

Challenge: Functioning Blackjack Game [closed]

This is kept fairly original: Write a program that creates a standard blackjack game: input "h" means hit or draw another card input "s" means stand, or take what you have already Rules: cards ...
19
votes
4answers
413 views

Hexagonify™ a String Block

Sandbox What is Hexagonification™? Hexagonification™ is a transformation that creates a hexagon with 3 copies of a rectangle block, each skewed to the right by 30 degrees and then ...
17
votes
11answers
3k views

Advent calendar

Let's build an advent Calendar for this Christmas! Many Advent calendars for children take the form of a large rectangular card with numbered windows for each day of December starting from 1 ( ...
19
votes
13answers
2k views

Check if simple regex matches string

A simple regex is either: _ (which matches the empty string) Any lowercase letter a to z (...
23
votes
17answers
4k views

Pass on your radiation

The task here is pretty simple. You should write a program that takes a string as input and outputs it (that is a cat program). Additionally when the \$n\$th byte of your program is removed (without ...
18
votes
3answers
477 views

On the Subject of Memory

This challenge is from a game called Keep Talking And Nobody Explodes. Memory is a fragile thing but so is everything else when a bomb goes off, so pay attention! – from the manual The Objective A ...
15
votes
1answer
245 views

Can this knot be colored with 3 colors?

In this challenge you will be asked to take a knot and determine if it can be colored in a particular way. First we draw a diagram of the knot. We use the standard way of drawing knots where we put ...
0
votes
6answers
292 views

Give me the first day of next month

Simple question! Given a string that contains a date in ISO8601 format, print the first of the next month in ISO8601 format. Example inputs: 2018-05-06 ...
28
votes
5answers
2k views

Longest Prime Sums

Sandbox There are special sets S of primes such that \$\sum\limits_{p\in S}\frac1{p-1}=1\$. In this challenge, your goal is to find the largest possible set of primes that satisfies this condition. ...

15 30 50 per page