All Questions

Filter by
Sorted by
Tagged with
2 votes
1 answer
6 views

Join Columnar Strings

Write the shortest possible program or function that will join a list of columnar strings. For this challenge, columnar strings are defined as one-character-wide strings spanning across multiple lines....
  • 4,393
2 votes
0 answers
9 views

Make the cheapest cut

“Cut” a matrix of integers on the line where the sum of the absolute differences of “severed” neighbors is the least. Example Consider this matrix: ...
  • 8,566
4 votes
1 answer
140 views

Encoder/Decoder for efficient number storage!

Description Inspired by this question, write a program/function to encode a number and a program (possibly the same as the first) to decode a bitstream in variable-length encoding as follows (taken ...
  • 2,158
21 votes
12 answers
681 views

CGAC2022 Day 1: Let's build a chocolate pyramid!

Following last year's event, we're doing Code Golf Advent Calendar 2022! On each day from today (Dec 1) until Christmas (Dec 25), a Christmas-themed challenge will be posted, just like an Advent ...
  • 67.1k
19 votes
9 answers
2k views

Totally random Catan number distributions

I like to play (The Settlers of) Catan on Board Game Arena with totally random number tokens. These tokens determine the production rate of the terrain tiles beneath: There are 18 number tokens, two ...
  • 1,263
0 votes
0 answers
97 views

Bridges of Königsberg [closed]

This is a famous mathematical problem, Named as Bridges of Königsberg Task The bridges of Königsberg is a problem in mathematics which states that the path required for crossing each bridge exactly ...
18 votes
38 answers
2k views

Range of ASCII values

Your task Given a string, output the range of ASCII values. Example Let's say we have the string Hello. We get the ASCII values: ...
  • 3,362
14 votes
6 answers
1k views

Shortest path between two directories

The challenge is to write a program which will find the shortest (least number of characters) command which will navigate to a target directory, given a starting directory, assuming a standard linux ...
  • 149
11 votes
24 answers
1k views

Find the nth number where the digit sum equals the number of factors

(This is OEIS A057531.) Your task Given a positive integer, \$n\$, find the \$n\$th number where the digit sum equals the number of factors Explanation For example, let's take 22: Its factors are \$[1,...
  • 3,362
-8 votes
3 answers
212 views

Fastest code: Does a list of string contains %s, %d, %f, or %r?

The aim is to create an algorithm to detect that one of the string in a small list of strings contains %s, %d, ...
  • 317
-4 votes
0 answers
54 views

Render numeric string/date/time using unicode block drawing characters [closed]

Am looking for a way to render numeric string/date/time using unicode block drawing characters like in example below. Ideally this could have been solved with a figlet font but couldn't find one. ...
36 votes
14 answers
2k views

Base Neutral Numbering System

It frustrates me that when you say "base 16", the 16 is in base 10. We need a base neutral way of writing down numbers when favoring a specific base would be inappropriate. How it works We ...
  • 4,696
8 votes
0 answers
176 views

Is it a legal atomic chess move?

Background and Rules There is a variant of chess called atomic chess, which follows essentially the same rules as normal chess, except that pieces explodes other pieces around them when captured. In ...
  • 9,971
15 votes
21 answers
2k views

Rarity of a String

Input: A string Output: The rarity of the string, as described below. To find the rarity of a string, follow the steps below. Start with 0. Subtract 3 for each E, A, T, or O in the string. Subtract 2 ...
user avatar
15 votes
14 answers
1k views

1 to N column and row sums

Inspiration There is a problem on the most recent AMC 12B test, the one held on November 16, 2022, which goes like this: (AMC 12B 2022, Question 17) How many \$4\times4\$ arrays whose entries are \$0\...
  • 9,971
11 votes
2 answers
502 views
+50

Interstellar Cabbages, Wolves, and Sheep

The Cabbage, Wolf, Goat riddle with a twist! Backstory: There’s an intergalactic river than needs to be crossed! Being a space-ferryman you’ve offered some aliens on your small space ferry that can ...
16 votes
17 answers
2k views

Number to letters

Your task Given a numerical string or integer \$\ge 0\$ (which may have leading zeros), convert it to letters using the below rules. Rules Loop through the digits: If the digit is ...
  • 3,362
12 votes
3 answers
407 views

Decide whether a given field of the board game 'Qwirkle' is valid (according to game rules)

The famous game of Qwirkle has simple but intricate rules (See part 2 of this question for a summary of the rules!) The Challenge You are somehow (text input, function parameter, whatever) given a ...
  • 117
4 votes
3 answers
139 views

Intermediate Boolean Algebra Calculator

Background With the success of Simple Boolean Algebra Calculator, I present a more difficult problem. Boolean Algebra concerns representing values with letters and simplifying expressions. The ...
5 votes
2 answers
178 views

Transform a lattice polygon to minimum diameter by shearing

Given is a grid polygon by the list of its integer vertex coordinates arranged along the perimeter, in the form \$(x_1,y_1), (x_2,y_2), \cdots , (x_n,y_n)\$ with \$n \ge 3\$. The polygon is completed ...
13 votes
7 answers
677 views

Implement Casio's M

The task Most Casio calculators featured a variable M, which has 3 operators related to it: M, ...
  • 1,665
8 votes
8 answers
615 views

LS, Part 1: Ana Gram

Warning: Wouldn't you rather answer a challenge about ponies?1 If you have read The Hostile Hospital, you would know that the Baudelaire orphans, from one of the scraps of paper recovered from the ...
19 votes
7 answers
2k views

Farigiraf my Girafarig

A palindrome is a word that is its own reverse. I will define the left palindromic root of a word as the shortest prefix of the word for which the shortest possible palindrome that begins with that ...
10 votes
4 answers
751 views

Implement Perceptron

There was a previous perceptron question but it was closed. Also it required a lot of extra stuff that's not normally part of the perception algorithm like I know it. This question will be much ...
  • 4,696
15 votes
13 answers
1k views

Lengthy numbers type A : remove all occurrences of length

Given a non negative integer number tell if it can be erased by repeatedly removing all occurrences of the length of that number from it including overlapping matches. Erasing means cancel all its ...
  • 10.4k
37 votes
4 answers
4k views

50 digits of π in HQ0-9+-INCOMPUTABLE?

Background HQ0-9+-INCOMPUTABLE?! is a half-joke programming language introduced in Internet Problem Solving Contest 2011, Problem H. HQ9+ is an esoteric programming language specialized for certain ...
  • 67.1k
29 votes
19 answers
2k views

Simple Boolean Algebra Calculator

Background Boolean Algebra concerns representing values with letters and simplifying expressions. The following is a chart for the standard notation used: Above is what actual boolean algebra looks ...
19 votes
12 answers
727 views

As many near-repdigit primes as possible

A near-repdigit number is a positive integer where all the digits are the same, except one. For example 101 and 227 are near-repdigits. A near-repdigit prime is a near-repdigit that is also prime. For ...
  • 1,339
15 votes
5 answers
475 views

Perfect Nontransitive Sets

Background For the purposes of this challenge, we'll define a "perfect nontransitive set" to be a set \$A\$ with some irreflexive, antisymmetric relation \$<\$, such that for all \$a \in ...
24 votes
20 answers
2k views

"Prime" pyramid

The pyramid begins with the row 1 1. We'll call this row 1. For each subsequent row, start with the previous row and insert the current row number between every ...
  • 13.3k
21 votes
10 answers
1k views

Traverse a rectangle's antidiagonals

There exists a bijection between the natural and rational numbers that works (approximately) like this: You create a 1-indexed 2-dimensional grid. In every field of this grid with position ...
  • 313
-11 votes
11 answers
269 views

Check if my input was 'hi whats up' without using any of those letters in your code

Write a script, program or function which takes one input of type string and outputs or returns some sort of indication wether the input string was 'hi whats up' (without the apostrophes) or not. You ...
  • 117
21 votes
6 answers
2k views

For xor Young (15+)

A Young diagram is a rectangular binary mask whose every row and every column are sorted in descending order. It is easy to check that every rectangular binary mask can be formed by xor-ing together a ...
  • 11.1k
21 votes
24 answers
2k views

Fractional Unicode Bars

Your program should take as input a number n that is greater than 0 and output a bar composed of n // 8 ▉ characters (U+2588), ...
  • 4,504
23 votes
40 answers
2k views

Maximum average ord

Your task Take a list of strings as the input, and output the maximum average ord. Example Given the list ...
  • 3,362
19 votes
9 answers
999 views

Is this substring list ambiguous?

Given a set of substrings, such as [ca, ar, car, rd], it's possible to create infinitely many strings by concatting them together. Some examples of this for the ...
20 votes
10 answers
847 views

Counting Stripey Bracelets

A bracelet consists of a number, \$\mathit{N}\$, of beads connected in a loop. Each bead may be any of \$\mathit{C}\$ colours. Bracelets are invariant under rotation (shifting beads around the loop) ...
5 votes
21 answers
392 views

Iterate through addition of number sequence until a single digit [closed]

Challenge: With any given number that has multiple digits, every digit in the number needs to repeatedly be summed together until the sum is a single digit number. To make things interesting, if there'...
  • 87
20 votes
48 answers
3k views

RGB to hexadecimal

Based off a Scratch project The pen extension in Scratch has a set pen color to () block. The () is normally a color dropdown, ...
-3 votes
0 answers
224 views

Subleq image decoder

In this challenge you need to create image.slif file, which contains compressed image. Such file should consist of two parts - header, which is constant for this ...
  • 23
23 votes
28 answers
1k views

Power sequence differences

Your task Given two positive integers \$x\$ and \$d\$ (such that \$d<x\$), output the 5th term of the \$d\$th difference of the sequence \$n^x\$ Example Let's say we are given the inputs \$x=4\$ ...
  • 3,362
-1 votes
0 answers
68 views

Caesar Shift string by 3 letters [duplicate]

Given a string as input, return the string with all characters shifted by 3. For example, when given hello as input return khoor ...
3 votes
2 answers
490 views

How Mondrian is your fine art collection? [closed]

For the purpose of this challenge a rectangular piece of ASCII art is Mondrian if it looks the same upside down. What does "looks the same" mean? A feature is any orthogonally connected ...
  • 11.1k
27 votes
13 answers
2k views

Is this series of quotes valid Python?

Python string parsing has quite a few edge cases. This is a string: "a" Putting 2 strings immediately after each other implicitly concatenates them, so ...
  • 4,696
19 votes
28 answers
2k views

Length of Binary as Base 10 [OEIS A242347]

Computers like binary. Humans like base 10. Assuming users are humans, why not find the best of both worlds? Your task is to find the first n terms in the sequence ...
29 votes
17 answers
2k views

Looking back at all the things I said ...

The look-say sequence is a sequence of lists of numbers where each element is the previous element with run length encoding. Run length encoding is the process of grouping together like elements and ...
  • 91.5k
27 votes
12 answers
1k views

Increment, decrement, undo, peek

Write a program or function (hereafter "function") that returns or prints the source code of four new functions: Increment, decrement, undo, and peek. The initial function contains an ...
  • 8,566
23 votes
6 answers
936 views

Tic, Tac, stub your Toe

Find the max number of Xs you can fit onto a rectangular tic-tac-toe board of length l and height h without ever having 3 consecutive Xs in a row diagonally, horizontally, or vertically. This is a ...
17 votes
22 answers
2k views

Remove the last 'n' occurences of a substring from a string

Given a string and a substring and a positive integer n. Remove the n occurences of a substring from the end of the originally ...
  • 199
19 votes
9 answers
2k views

Enumerate the rationals

The cardinality of the set \$\mathbb Q\$ of rational numbers is known to be exactly the same as that of the set \$\mathbb Z\$ of integers. This means that it is possible to construct a bijection ...
  • 17.7k

15 30 50 per page
1
2 3 4 5
268