All Questions

10,799 questions
Filter by
Sorted by
Tagged with
321 views

Billiard balls collision

Given the 2-dimensional positions and velocities of a pair of billiard balls right before impact, calculate their velocities after a perfectly elastic collision. The balls are assumed to be ideal ...
366 views

Talk interpreter

"Talk" is a baroquified accumulator-based language that is created in response to Dennis's quote on talk.tryitonline.net. ...
522 views

Tex Quotes(UVa 272)

Given a string, replace all left-double-quotes into two backticks and all right-double-quotes into two single-quotes. Left-quotes means the quotes that starts a quote. Right-quotes means the quotes ...
197 views

Church Subtraction

Church Subtraction Lambda calculus has always been a fascination of mine and the emergent behaviors of passing functions into each other is delightfully complex. Church numerals are representations ...
447 views

The Knight's estate

And then the King said: You fought bravely, Knight, and your deed will not be forgotten for centuries. For your valor I grant you this castle and the lands around it. Things rush me, and I can not ...
874 views

Nothing like a good ol' game of ModTen

Disclaimer: ModTen is a fictional card game which was created for the sole purpose of this challenge. The rules of ModTen ModTen is played with a standard 52-card deck. Because the full rules are ...
392 views

The fastest Sudoku solver

The goal of a game of Sudoku is to fill the board with the numbers 1-9, one in each cell, in such a way that each row, column and box only contains each number once. A very important aspect of a ...
43 views

DCC model estimation with t-Student distribution rmgarch [on hold]

I was analyzing and implementing the DCC model (Dynamic Conditional Correlation) for the one-day forecast calculation of the variance-covariance matrix of a system consisting of, approximately, 30 ...
2k views

Round towards zero

This is a simple task. Given a positive or negative real number, round it to the next whole integer closer to zero. The challenge Take input through any reasonable form (stdin, function, etc.) of ...
2k views

Numbers Decrease while Letters Increase

Randomly inspired by Numbers Increase While Letters Decrease Given a list of mixed letters and integers (e.g., ['a', 2, 3, 'b']) increase the letters by one ...
1k views

Irish Snap: Variant Rules

Introduction Recently, me and a couple of my friends decided to play some cards, and one of them suggested the game 'Irish Snap', which was the inspiration for this challenge. However, I later learnt ...
6k views

Who was president of the USA?

Challenge Write a program that takes as input a day from April 30, 1789 to August 21, 2019 and returns as output who was president of the USA that day. Notes For the list of US presidents, the ...
1k views

Start from ones

Given a strictly positive integer n, follow these steps: Create an array A with n 1s. If A only has one element, terminate. Otherwise, starting from the first element, replace each pair of A with its ...
2k views

Fancy String Replace

let S, a and b each represent a string Goal: Write a standard string replace function where ...
287 views

The challenge Given two strings, each of length up to 30, consisting of printable ASCII characters (codes $[32, 126]$), put them onto a balance scale in the fewest bytes of code! This consists of ...
380 views

caN it be acrOnymised? [duplicate]

The Typical Way to Make an Acronym Out of a Phrase Is to Take the First Letter of Each Word: TTWMAOPITFLEW. howeveR, sometimEs, you can make an acronym of random ...
6k views

Church Booleans

Church booleans A Church boolean is a function that returns x for true and y for false where ...
10k views

How much code would a codegolf golf if a codegolf could golf code?

Write a function or program that takes two words as input and outputs variants of the popular English tongue-twister "How much wood would a woodchuck chuck if a woodchuck could chuck wood?". The ...
247 views

Identical grids

You’re given two $r×c$ grids. Each cell contains either 0 or 1. What are the minimum number of swaps (between horizontally and vertically adjacent cell elements, no wrapping i.e no swapping between ...
293 views

The task is to write a radiation-hardened irradiator. What do I mean by that, exactly? An irradiator is a program that, when given a string as input, will output all possible versions of the string ...
664 views

Lazy brainfuck programmer [closed]

Background Joe is working on his new Brainfuck answer on Codegolf. The algorithm he's using to solve the challenge is a bit complicated, so Joe came up with idea of simplifying his Brainfuck notation ...
8k views

!I!n!s!e!r!t! !n!b!e!t!w!e!e!n!

Posted from here. This challenge is highly "distilled" from this question. Special thanks to @Akababa! In this task, you should insert an exclamation mark at the start of the string and after every ...
2k views

Levenshtein Neighbours

Most square numbers have at least 1 different square number with which their Levenshtein distance is exactly 1. For a given square $x$, each square that meets this condition is called a Levenshtein ...
110 views

A prescribed time length [closed]

Challenge Write a program that takes as input an integer 1 <= n <= 50 and returns a text string of length n stating a time in the English language. Example Input: 20 Output: "It's six thirty-...
2k views

The Lucky House

There's a minigame in Super Mario 3D World known as the Lucky House. It consists of a slot machine with 4 blocks. Each block may be one of 5 different icons (Flower, Leaf, Bell, Cherry or Boomerang) ...
2k views

Output with the same length always

With challenges like Output with the same length as the code and Create output twice the length of the code, I thought of a separate, but similar challenge. The task is to produce an output. It can ...
82 views

JSON data exchange between Python files [closed]

I'm having a hard time in my code. The question may be silly but for me it's pretty hard because I'm starting with python I have this selenium python code. I just simply need to return a JSON if one ...
146 views

Decompose Commutators

A theorem in this paper1 states that every integral n-by-n matrix M over the integers with trace M = 0 is a commutator, that means there are two integral matrices A,B of the same size ...
7k views

Build a mob of suspiciously happy lenny faces ( ͡° ͜ʖ ͡°)

I was going through a bizarre thread on Reddit, and came across this: ( ͡°( ͡° ͜ʖ( ͡° ͜ʖ ͡°)ʖ ͡°) ͡°) It's representing a group of people smiling somewhat suspiciously. (In the challenge below ...
122 views

Elimination ordering

Your task is to remove smallest amount elements from a list, so the most elements are on their corresponding place. The element is on it's corresponding place, when it's value is equal to it's ...
151 views

Smallest self-hosting golfing language [closed]

Implement a golfing language that is implemented in itself. Formally speaking: The original compiler O (an executable file assumed to be implemented in other language X), when given its own source ...
205 views

Shortest Program To Find Lowest Common Ancestor of Two Nodes in a Binary Tree

Any two separate nodes in a binary tree have a common ancestor, which is the root of a binary tree. The lowest common ancestor(LCA) is thus defined as the node that is furthest from the root and that ...
500 views

Number in overlapping range

You are given two integers between lets say 1 and 12, one and two and a integer between lets say 0 and 4 which is called ...
207 views

Interpreter for number theory, modulo n

A sentence of number theory (for our purposes) is a sequence of the following symbols: 0 and ' (successor) - successor means <...
2k views

Output the list of musical notes

This task is simple: Write a program or function that outputs the list of all musical notes (using English note names) from A♭ to G♯. All notes without a name consisting of a single letter (i.e. ...
4k views

Attacking the Hydra

Instead of being a skillful warrior capable of slaying Hydras (see here and here), this time you are a warrior that has no prior knowledge on how to kill one or which weapons to use against the ...
968 views

An array battle with odd secret powers

Here is a relatively simple two dimensional array challenge. Imagine a battlefield of 625 foot soldiers. You command the odd troops, but unfortunately the strength of the even troops overwhelms you. ...
978 views

Chunk + Enumerate a list of digits

I have a list of decimal digits: 4, 4, 4, 7, 7, 9, 9, 9, 9, 2, 2, 2, 4, 4 The list of decimal digits are known as items. We can form "chunks" from these items by ...
2k views

Lípínguapua dopo Pêpê

Língua do Pê, or P Language, is a language game spoken in Brazil and Portugal with Portuguese. It is also known in other languages, such as Dutch and Afrikaans. (Wikipedia) There are some dialects in ...
488 views

Create the least compressible picture

"A picture is worth a thousand words"—so the old saying goes. The average word is about four characters long, so a picture conveys 4kB of information. But how much entropy, rather than information, ...
5k views

Telephone number in spoken words

Goal Write a program or function that translates a numerical telephone number into text that makes it easy to say. When digits are repeated, they should be read as "double n" or "triple n". ...
230 views

Crossing sequences

Crossing Sequences Given a list of positive integers A, call it an increasing sequence if each element is greater than or equal to the previous one; and call it a ...
2k views

Simplification of numbers

How, you can’t remember the 6 or 7-digit phone number that appeared on the TV screen for a second?! Using the special technique described below, you will turn into a walking phonebook! Obviously, the ...
6k views

Is this n-speak?

Inspired by Is it double speak?, I devised a harder challenge. Given a string, determine if the string is n-speak, for any $n\geq 2$. N-speak is defined by repeating each letter $n$ times. With \\$...
194 views

Print an array as a table [closed]

Write a program that prints an associative array (key-value) to a table. Requirements Standard loopholes are forbidden Please include a link to an online interpreter and the byte count in the ...
7k views

The cat ate your input again!

Create a cat program, a.k.a a program that takes an input and prints it. ...Except, the program will randomly take characters away from your input and print that instead. Each character in the input ...
6k views

Generate Brainfuck for the numbers 1–255

Write a program that, for the numbers 1 through 255, prints out BF code that will produce the given number in some byte of the array, plus a newline. For example, the first four lines of the output ...
209 views

The Practice of Programming

At 1998, Brian Kernighan, while working on the book "The Practice of Programming", wanted to demonstrate realisation of regular expression engine. But struggled to find small engine, that cod could ...
3k views

Y2K… in 2019?

It's August 10th, 2019, but your task still involves Y2K. Weird, right? Create a program that prints itself, with a two digit number appended to it. The first time you run it, it should append 00 to ...
290 views

Bucket interpreter

Create a program that interprets the programming language Bucket. Bucket works on two buckets: the first can hold A and the second can hold B units of liquid. The things you can do with these buckets ...

15 30 50 per page