Questions tagged [code-challenge]

A code challenge is a competition for creative ways to solve a programming puzzle with an objective winning criterion not covered by other scoring tags (e.g. code-golf).

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

How Many Staircases [duplicate]

Problem You're a staircase engineer on a house and realize you only have n rectangles to create a staircase. So you are tasked with finding the number of ways to ...
3.14's user avatar
  • 327
26 votes
39 answers
4k views

Repeat your program to print Fibonacci numbers

Write a program fragment so that, when repeated N times it prints the Nth Fibonacci number. For example, if your program is print(x) then: ...
mousetail's user avatar
  • 11.4k
10 votes
12 answers
2k views

Encrypting Emojis

Problem You are tasked with creating a program that performs emoji encryption on a given string of emojis. In this encryption scheme, each emoji is replaced by a unique character (from ...
3.14's user avatar
  • 327
19 votes
10 answers
2k views

How Turing complete is your language?

Find the maximum possible number of disjoint sets of characters, that are Turing complete subsets of your language. Rules: You can assume your Turing complete subset is contained in/called from a ...
bsoelch's user avatar
  • 4,781
8 votes
8 answers
602 views

Magic OEIS formulae (Robbers' thread)

This is the robbers' thread. See the cops' thread here. In this cops and robbers challenge, the cops will be tasked with writing an algorithm that computes some function of their choice, while the ...
dingledooper's user avatar
  • 22.2k
12 votes
9 answers
700 views

Magic OEIS formulae (Cops' thread)

This is the cops' thread. See the robbers' thread here. In this cops and robbers challenge, the cops will be tasked with writing an algorithm that computes some function of their choice, while the ...
dingledooper's user avatar
  • 22.2k
1 vote
1 answer
176 views

Most elegant one-liner to generate sqlite INSERTs

Challenge You find yourself in a bash terminal, and want to do some simple tests on sqlite3. So you issue the following command: ...
ChrisB's user avatar
  • 119
1 vote
0 answers
123 views

making a binary string palindrome using xor operations [closed]

Problem You are given a binary string A of length N. You can perform the following type of operation on the string A: Choose two different indices \$i\$ and \$j\$ (\$1 \le i\$, \$j \le N\$) Change \$...
hemanth's user avatar
  • 11
3 votes
4 answers
991 views

Write the smallest possible code in x86-64 to implement the "<=>" operator

Languages, such as C++, have introduced a new comparison operator: <=>. This operator returns -1, 0, or 1† when comparing two items together: −1 means the ...
Alexis Wilke's user avatar
19 votes
17 answers
2k views

Approximate my atomic weight

Each element on the periodic table of the elements has an atomic weight. For example, boron (element 5) has an atomic weight of 10.81. Your challenge is to write a program which takes as input the ...
Ginger's user avatar
  • 5,390
12 votes
3 answers
471 views

><> numbers metagolf

I struggle to easily encode big numbers in ><>. If only there was a program that could find the best way for me? What is ><> ...
mousetail's user avatar
  • 11.4k
25 votes
54 answers
3k 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: ...
The Thonnu's user avatar
  • 17.5k
39 votes
5 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 ...
Bubbler's user avatar
  • 73.2k
3 votes
4 answers
871 views

A multidimensional strategy challenge

The wizard is determined to pose the most challenging challenge yet for which he believes the previous solution techniques will not work. He decides to go multidimensional. If there is a number line ...
user avatar
17 votes
11 answers
2k views

Numbers vs. Strings: Language fitness challenge

inspired by thejonymyster's idea Rules This challenge is about finding languages that are very suitable for one task but quite the opposite in the other. The two tasks share a theme, but Task 1 is ...
Bubbler's user avatar
  • 73.2k
8 votes
0 answers
392 views

Turing Machine that outputs pi

Turing Machine Preliminaries A Turing machine is specified by the following data A finite set of symbols S = \$\{s_1,s_2,...\}\$ A finite set of states M = \$\{m_1,m_2,...\}\$ A partially defined ...
QCD_IS_GOOD's user avatar
25 votes
11 answers
3k views

Write a program with the smallest width

Print or return the following text: Hello world! The quick brown fox jumps over a lazy dog. However, your submission will not be scored in bytes. Instead, ...
Sisyphus's user avatar
  • 14.4k
5 votes
4 answers
609 views

Strategy: The cunning cousin witch

The wizard has a cunning cousin who is a witch. She looks down on the wizard, regarding him and his puzzles as mathematically naive. On reading his latest puzzle, she scorned him for always asking ...
user avatar
5 votes
2 answers
917 views

Optimal strategy to defeat the wizard

In this game, you can look inside one box at a time chosen by you. When you do that, you can see how many coins there are in that box. The wizard has one last twist for you. At any point, you can ...
user avatar
20 votes
12 answers
3k views

Optimal strategy for wandering robots

If the agent is at the origin it always moves right when you choose it. The goal is to get one agent to 10. The cost is the sum of the square of the total number of moves (left or right) taken by each ...
user avatar
6 votes
2 answers
287 views

Case Conversion Polyglot

Your task is to write a program that performs case conversion from plain text, and other case formats, into one of the specified formats below. Inputs will be either plain lowercase text, or one of ...
Dom Hastings's user avatar
  • 22.8k
5 votes
7 answers
827 views

Typo resistant pin codes [closed]

Background I was working on a system where for convenience (not security) people could use four digit codes to identify themselves. I figured this is something that may actually be useful in many real ...
Dennis Jaheruddin's user avatar
5 votes
0 answers
233 views

Find the best character arrangement

You want to write your English essay. However, all characters on your keyboard broke other than the arrow keys and the enter key. You want to find out how to place the characters so you can write your ...
Command Master's user avatar
19 votes
11 answers
2k views

Write a near crystalline program

A pristine program is a program that does not have any errors itself but will error if you modify it by removing any contiguous substring other than the entire program. A crystalline program is sort ...
Wheat Wizard's user avatar
  • 95.5k
1 vote
1 answer
252 views

Implement the slowest possible sorting algorithm that retains a fast best case [closed]

I have recently been on a quest to create really really slow sorting algorithms that make Bogosort seem like it is the best. The task is simple: Sort an array of integers in as long average time as ...
Eknoma's user avatar
  • 27
-12 votes
5 answers
332 views

12 with no 1234567890, but polyglot

This is my 12th question, so I thought of this idea. Goal: Output 12, with any preceding or trailing whitespace permitted In as many languages as possible (where different versions or flags count as ...
Number Basher's user avatar
29 votes
21 answers
4k views

Add a hidden language to a polyglot

Inspired/mostly copied but I don't think it's a dupe. Also Inspired. In this challenge, you will create polyglots that include all languages from previous answers, and another language which you won't ...
emanresu A's user avatar
  • 34.5k
6 votes
1 answer
658 views

Irradiated Polyglots

Design a function or program that, when run normally, outputs the triangular numbers. However, when any single character is deleted, the program/function should not function in the original ...
Romanp's user avatar
  • 1,357
5 votes
1 answer
184 views

BitCycle Metagolf

Background BitCycle is a two-dimensional Turing-complete programming language involves moving bits around a playfield. Because I am too lazy to write BitCycle programs myself, you will be writing a ...
Aiden Chow's user avatar
  • 12.3k
27 votes
28 answers
4k views

What's the Missing Code? (Cops)

Cops' Challenge Robbers' challenge here. It has now been four days since the challenge was posted so all new answers should be marked as non-competing in the title. These answers can still be cracked ...
Lecdi's user avatar
  • 1,155
3 votes
0 answers
185 views

Calculate the probability of getting this hand in n tries [closed]

Imagine there is a card game where the primary objective of the game is to get 4 of one card in your hand. Game mechanics Each player starts of with 10 cards in their hand. The remaining 32 cards (...
violetorigin's user avatar
4 votes
3 answers
275 views

Find All Digitroot Cyclic Sequences With Length Greater Than One

Digital sum, DR, Digit root is the iterative process of summing digits of a number until you end up with a single digit root number: e.g. digit root of 12345 is 6 since 1 + 2 + 3 + 4 + 5 = 15 = 1+5. ...
jixperson's user avatar
  • 197
3 votes
2 answers
266 views

Implement constant-latency branchless multiplication efficiently

Modern hardware can perform multiplication very fast in a constant latency of 3~4 cycles. But some tiny chips for embedded environments sometimes lack hardware multiplication, which has to be emulated ...
xiver77's user avatar
  • 2,325
9 votes
3 answers
1k views

Build an optimizing Brainfuck compiler/interpreter

the goal Build an optimizing Brainfuck implementation. Whether it is a compiler, an interpreter, a JIT compiler, or whatever else is up to you. scoring A reference implementation (...
xiver77's user avatar
  • 2,325
6 votes
3 answers
297 views

Write a regex that would increment a 2-digit hexadecimal number

Your regex will receive a string of the form !XX! #<extra> where X is any hexadecimal digit (0-9 and A-F capital letters ...
Itay123's user avatar
  • 71
13 votes
1 answer
572 views

Longest infinite loop in 5 states

Challenge Statement The goal of this challenge is to build the 5 state Infinite Time Turing Machine that takes the longest to halt. Since Infinite Time Turing Machines can run for infinite time your ...
Wheat Wizard's user avatar
  • 95.5k
0 votes
0 answers
214 views

Infinite-Time Busy Beaver

An infinite time Turing machine is a generalization of a Turing machine to infinite computation lengths. It has three tapes: two of them are blank initially, and the other one contains the input to ...
Binary198's user avatar
  • 523
6 votes
2 answers
286 views

Generate Matching Regexes

Write a program that takes two lists of strings and generates a javascript regex that fully matches all the strings in the first list and matches none of the strings in the second list. To be specific ...
user197974's user avatar
  • 1,161
10 votes
8 answers
602 views

Biggest katlani noun dictionary in 400 bytes

Katlani is a constructed language being designed in chat. In this challenge, your goal is to print the largest dictionary of katlani nouns possible in 400 bytes or less. Task In 400 bytes or less, ...
Rydwolf Programs's user avatar
8 votes
8 answers
415 views

From code to golf (Robbers' thread)

This is a cops-and-robbers challenge, the cops' thread is here You can change the word code into golf by changing a letter at a ...
emanresu A's user avatar
  • 34.5k
12 votes
10 answers
851 views

From code to golf (Cops' thread)

This is a cops-and-robbers challenge, the robbers' thread is here You can change the word code into golf by changing a letter at ...
emanresu A's user avatar
  • 34.5k
6 votes
1 answer
202 views

Represent any integer with an expression that uses no digit besides '4' [closed]

Fourward (Introduction) I have an unhealthy obsession with the number 4. I love it so much, in fact, that seeing any other digit is frustrating to me. I therefour wish to create a 'Fourier ...
Aos Sidhe's user avatar
  • 169
-2 votes
1 answer
201 views

Program compressor

Choose a language and write a program in the language that: Take a valid program of the language as input, Output a string(bytearray, etc.). It needn't be a valid program. Only finite valid inputs ...
l4m2's user avatar
  • 19.1k
20 votes
6 answers
2k views

Wordle solver challenge

Wordle is a daily online word game that has received considerable attention recently. The Game The object is to guess a secret word in the fewest attempts. Consider the following instance of the game: ...
Dustin G. Mixon's user avatar
-7 votes
2 answers
142 views

Multiplying numbers [duplicate]

Your task, is simply to multiply 2 integers given in input, separated by a ",". The catch is, you cannot use the multiplication operator "*", even if it is being used differently, ...
DialFrost's user avatar
  • 5,035
23 votes
6 answers
2k views

Play the Fruit Box Game

Play the Fruit Box Game Intro Fruit Box is a game consisting of a 10x17 grid of numbers, each between 1 and 9, where the goal is to clear as many numbers as possible in a two-minute time window. In ...
Theo's user avatar
  • 509
18 votes
1 answer
761 views

Largest SKI output in less than 200 combinators

The Challenge Create an terminating expression in SKI Combinator Calculus in less than 200 combinators (S, K, I) that reduces to the expression with the most combinators. There will be no limit on how ...
nph's user avatar
  • 743
25 votes
20 answers
1k views

Kolmogorov-simple numbers

If you visit Code Golf often, you may have heard of Kolmogorov complexity. It's usually defined as the amount of bytes required to express some string in a programming language. Here the Kolmogorov-...
AnttiP's user avatar
  • 7,670
-1 votes
1 answer
678 views

Draw Lines in ASCII [closed]

Challenge Draw lines in ASCII corresponding to given inputs: in the first line there are given size of rows and columns of the view and number of separators between each point in the second line is ...
jixperson's user avatar
  • 197
28 votes
11 answers
2k views

Infinite ordinals from a well-ordering

Your task is to write a short program that represents a large (infinite) ordinal, using a well-ordering of the set of positive integers. Your program will take two different positive integers and ...
AnttiP's user avatar
  • 7,670

1
2 3 4 5
18