All Questions

Filter by
Sorted by
Tagged with
1 vote
0 answers
141 views

Produce a secure block cipher round function (1 bit round key; 7 bit message)

We need to produce a block cipher round function with a 1 bit round key size and a 7 bit message size with the highest level of cryptographic security according to our measure of security. ...
Joseph Van Name's user avatar
18 votes
39 answers
2k views

Rudin-Shapiro sequence

The Rudin-Shapiro sequence is a sequence of \$1\$s and \$-1\$s defined as follows: \$r_n = (-1)^{u_n}\$, where \$u_n\$ is the number of occurrences of (possibly overlapping) \$11\$ in the binary ...
alephalpha's user avatar
15 votes
2 answers
2k views

Shortest Algorithm* That Generates a Harlequin Pattern

What is the shortest sequence of moves that, from the solved state of the cube, creates a pattern that meets the following criteria: 6 colors on each face at most 2 facelets of the same color no ...
q-l-p's user avatar
  • 293
10 votes
3 answers
580 views

Get the Bible verse

Write a program that accesses Project Gutenberg's KJV Bible, either from a file called pg10.txt in the working directory or in any other way that is typical for the ...
Someone's user avatar
  • 1,580
-4 votes
4 answers
234 views

Answer a Loaded Question (with Lojban!) [closed]

A loaded question is something like 'Have you stopped swearing?' in which both yes and no answers mean that I have swore, meaning it is impossible to answer the question if I haven't swore. However, ...
3-1-4-One-Five's user avatar
20 votes
9 answers
2k views

Limited letter renderer: BIOPD

There have of course been challenges to render ASCII art fonts here and there. This challenge doesn't add anything to those. In contrary, it subtracts from them for a good reason. If you allow all ...
Philippos's user avatar
  • 2,501
13 votes
21 answers
4k views

German pharmacy payment

Your task is to calculate the amount you have to pay for prescribed medication at a pharmacy in Germany. The amount is simply based on the full price of the item, which will be your input. It is a ...
corvus_192's user avatar
  • 5,097
-10 votes
1 answer
390 views

Bingo Cards PDF

Write code to generate a PDF file containing 6 bingo cards. Winner is the one that uses the shortest code and needs no actions except for installing a library and running the code. (No Save As PDF). ...
paki eng's user avatar
  • 175
16 votes
13 answers
2k views

Golf Transmission

As in, the 5 speed transmission from the original VW Golf GTI. Print the transmission pattern in as few bytes as possible. Yes I know this isn't what it actually looks like but the GTI 5 speed shift ...
pacman256's user avatar
  • 3,770
14 votes
22 answers
2k views

Decode the date in Christmas Eve format

This is the inverse of "Encode the date in Christmas Eve format." Write a program that takes as input the string Christmas, possibly followed by ...
Someone's user avatar
  • 1,580
11 votes
36 answers
4k views

Print ASCII building

Challenge Display to the screen or write to stdout this exactly: ...
lame-lexem's user avatar
7 votes
2 answers
318 views

How many twisted corners?

Your challenge is to output the number of twisted corners given a 2x2 Rubik's Cube scramble. For the purpose of this challenge, twisted corners are defined as corners where the colour of the top/...
math scat's user avatar
  • 9,238
17 votes
23 answers
2k views

Monotone sequence beatitude

Provided that the input is a monotone sequence of three or more integers: Output -2 if the sequence strictly decreases. Example: [7,4,3,2] Output -1 if the ...
Dannyu NDos's user avatar
  • 5,941
11 votes
8 answers
2k views

Add two natural numbers

Given two natural numbers (less than 100) as input print the sequence of intermediate results obtained when computing the sum of the two numbers using only the following operations1: ...
bsoelch's user avatar
  • 6,015
7 votes
1 answer
286 views

Literate Programming in Base 26

Your task is to convert non-empty strings - between strings using the 26 letters, and programs, which are strings of bytes, where each byte has 256 possible values. You should use the same codepage ...
Command Master's user avatar
5 votes
9 answers
1k views

Print the banned characters based on the most common characters

This is an answer-chaining post, so in this challenge every answer (except the first answer) depends on the previous answer. The goal of this challenge is to output the restricted characters. The ...
Fmbalbuena's user avatar
  • 3,847
10 votes
6 answers
636 views

Robinson Schensted correspondence

[The explanations of the algorithm come from here. I recommend reading it for a beautiful description of the algorithm.] This challenge is to implement the Robinson Schensted correspondence. Input A ...
Simd's user avatar
  • 2,896
6 votes
1 answer
228 views

Determine if a Spider Solitaire game is stale

Let's introduce a simplified variant of the well known Spider Solitaire. From Wikipedia: The main purpose of the game is to remove all cards from the table, assembling them in the tableau before ...
Kamila Szewczyk's user avatar
13 votes
17 answers
3k views

Make Code Printing X without X

The challenge is simple: write a program which takes in some non-empty string \$n\$ consisting of only uppercase and lowercase ASCII letters, and outputs the code for a program (in the same language) ...
97.100.97.109's user avatar
32 votes
36 answers
6k views

aaabbabbc⠀⠀⠀⠀⠀⠀

One element of the list aa, ab, ba, bb, c has been removed, and the remainder shuffled and joined with no separator. Find the missing element. For example, if the ...
Sisyphus's user avatar
  • 14.8k
4 votes
3 answers
422 views

Is there a shortest code to format string

Code Golf Challenge Given a string of 10 characters: 'abcdefghij' I want to format it in this pattern and print it in the console in a minimum number of characters: ...
Karine Bauch's user avatar
9 votes
8 answers
672 views

Produce the shortest suffix for an (almost) arbitrary string

I encountered some silly code from a game and I figured this would actually turn into a fun golfing problem, so: Given any ASCII string in the limited char range specified below. Append as few ...
Olipro's user avatar
  • 199
17 votes
12 answers
1k views

Encode the input to exclude a given character (part 1)

Your task is to write 2 functions/programs. They may share code. The first function must, given a string and a character, output a new string that does not contain that character. The second function ...
mousetail's user avatar
  • 12.5k
6 votes
4 answers
609 views

Sum of the sum of all possible subsets raised to power k

You are given an array A of non-negative integers. You can pick any non-empty subset, S from the array A. The score of a subset S is the sum of the elements in S raised to the power of K, i.e. for a ...
chere 01's user avatar
16 votes
19 answers
2k views

Find the fairest partition of a list

Given a list of positive integers, partition the list into two sublists such that the absolute value of the difference of the sums over the two sublists is minimal. The output of the program should be ...
bsoelch's user avatar
  • 6,015
6 votes
4 answers
259 views

Positions on the Pickleball Court

My doubles pickleball group often has five people. Four are playing and one is awaiting the next game. We can represent the state of the game with a string of five characters like abCde. This ...
Ross Millikan's user avatar
12 votes
6 answers
2k views

Sine using square root [closed]

Given input \$x \in \left\{0,3,6,...,90\right\}\$, output \$\sin\left(x°\right)\$ using integer and \$+ - \times \div ( ) \sqrt{\cdot}\$(square root), e.g. \$\sin(45°)=\sqrt{1\div 2}\$. Flexible ...
l4m2's user avatar
  • 23.9k
12 votes
5 answers
1k views

The too-short urinal problem

The well-known Urinal Protocol states that each person that takes a urinal will take the one furthest from any other taken urinal. But this fails to account for short urinals; in many cases, a person ...
noodle man's user avatar
  • 6,903
14 votes
9 answers
2k views

Seat gangs as far as possible

Imagine there are \$n\$ people \$\{a_1, a_2, \ldots, a_n\}\$ who enter a room in order and sit down in \$n\$ seats, arranged in a row. Each of these people belong to some gang, indicated by an integer ...
97.100.97.109's user avatar
4 votes
5 answers
152 views

Base consecutive k-frequency counter [closed]

Given a base \$k\$ as well as two indices (also passed in base \$k\$, call them \$s\$ and \$e\$) return a list containing a frequency count of all base-\$k\$ digits occurring between \$s\$ and \$e\$ ...
Michael Klyachman's user avatar
-1 votes
1 answer
256 views

It's Just Simple Math! [duplicate]

Task Your boss is on another crusade for 'efficiency.' He wants to encourage the use of numbers with fewer syllables, so that they're easier to discuss in meetings. If you want to take some time off ...
Mark Harwood's user avatar
19 votes
29 answers
3k views

Restricted Meta-Cat

Your challenge, should you choose to accept it, is to write a program in a language of your choice that, when given a string (limited to printable ASCII) as input, outputs a new program in the same ...
noodle man's user avatar
  • 6,903
20 votes
35 answers
2k views

Compute the conjugate of a partition

We will think of a partition as a sequence of non-increasing integers. For a given partition into \$n_1, n_2, \dots, n_k\$ with \$n_1 \geq n_2 \dots n_{k-1} \geq n_k = n\$ we write it out with \$n_i\$...
Simd's user avatar
  • 2,896
17 votes
14 answers
2k views

Finding the power sandwich version 2

Introduction This question is inspired by this great question. Challenge Given a number \$N>0\$, output the largest integer \$a^b\$ that is smaller or equal to \$N\$, and the smallest integer \$c^d\...
Dmitry Kamenetsky's user avatar
6 votes
0 answers
264 views

Shortest CSS selector to select ALL html elements, without using asterisk *

What is the shortest selector (by character count) to select ALL html elements on a web page, without using asterisk (*)? Some examples are the following: ...
user3163495's user avatar
13 votes
10 answers
1k views

Directional Run Length Decoding

We all know run-length decoding: A list of character-length pairs expands to a string of that many characters, so A1B4C2 expands to ...
noodle man's user avatar
  • 6,903
-6 votes
1 answer
338 views

The longest "Hello World!" program [closed]

I was seen multiple shortest "Hello World!" program, but this is the longest program. The Rules Each submission must be a full program. This must be non-interpreted language (for example, ...
winapiadmin's user avatar
17 votes
20 answers
2k views

Last Week Day Of The Month

Introduction This challenge was inspired by a seemingly simple task requested at work that couldn't easily be done in Microsoft Teams. At least not from what we could find! Task Your task, if you ...
Mark Harwood's user avatar
15 votes
16 answers
2k views

Finding the power sandwich

Introduction Finding the closest power to a number is a common enough problem. But what if you need both the next-highest and next-lowest power? In this challenge you must find the closest powers to a ...
calvenable's user avatar
10 votes
6 answers
432 views

Hermite interpolation

We already have a challenge for polynomial interpolation: given a list of points, output the coefficients of the polynomial that passes through them. Hermite interpolation is a generalization of ...
alephalpha's user avatar
11 votes
6 answers
804 views

Find the conflict-free sitting arrangement

Party time! All of your guests are sitting around a round table, but they have very particular seating requirements. Let's write a program to organize them automatically! Guests are represented by ...
Philippos's user avatar
  • 2,501
6 votes
7 answers
3k views

Help, I can't bloody well memorize this number!

The Brits aren't exactly known for being good at memorizing stuff. That's why scientists need newspaper articles to find those who are, and that's why it shouldn't be a surprise that they forget more ...
leo848's user avatar
  • 637
18 votes
16 answers
3k views

Adversarial Iterated Prisoner's Dilemma

In this challenge, you will play the iterated Prisoner's Dilemma, but with a twist: There's also an adversary trying to mess you up! The Prisoner's dilemma is a scenario in game theory where there are ...
isaacg's user avatar
  • 42k
12 votes
7 answers
4k views

How can I shorten a C code that repeatedly outputs a number?

I wrote a code that separates the numbers from 1 to 9999 by comma void p(n){printf("%d,",n);if(n<9999){p(n+1);}}main(){p(1);} Is there a way to make ...
olivia's user avatar
  • 129
14 votes
10 answers
1k views

Expected number of rounds for this labeling scheme

Task Here is an interesting math problem: Let's say that there are \$n\$ indistinguishable unlabeled objects in a bin. For every "round", pull \$k\$ objects randomly out of the bin with ...
Aiden Chow's user avatar
  • 13.3k
5 votes
9 answers
4k views

Minecraft XP Orb Amounts

In the video game Minecraft, the player can obtain experience points (XP) from various activities. In the game, these are provided as XP "orbs" of various sizes, each of which give the ...
97.100.97.109's user avatar
19 votes
9 answers
1k views

Befunge Comment Outline Creator

Befunge is a 2-dimensional programming language, with an instruction pointer (IP). In Befunge-98, the ; character tells the IP to skip characters up until the next <...
SquareFinder's user avatar
9 votes
8 answers
1k views

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 consists ...
Wheat Wizard's user avatar
  • 98.7k
9 votes
5 answers
525 views

Write a variadic fixed point combinator

A fixed-point combinator is a higher order function \$\mathrm{fix}\$ that returns the fixed point of its argument function. If the function \$f\$ has one or more fixed points, then $$\mathrm{fix} f=f(\...
Legendary Wizard's user avatar
6 votes
0 answers
269 views

Write a proof checker for first order logic

This originally came from Give the best Chaitin incompleteness bound, but I realized that there was a fragment of this problem which still potentially gives a good coding challenge. First Order Logic ...
Charles Wang's user avatar

15 30 50 per page
1
3 4
5
6 7
281