Skip to main content

Questions tagged [code-golf]

Code-golf is a competition to solve a particular problem in the fewest bytes of source code.

2 votes
5 answers
46 views

Reduce a string up to idempotency

Objective Given a string consisting of printable ASCII characters (!0x21 ― ~0x7E), treat it as an element in the free idempotent ...
Dannyu NDos's user avatar
  • 5,981
2 votes
0 answers
60 views

How comparison-heavy is this list?

Given a list of strings in any convenient format display the amount of comparisons between individual characters that a merge sort algorithm would perform. The merge-sort algorithm is a divide & ...
Kamila Szewczyk's user avatar
6 votes
4 answers
195 views

Double dequer sort

In this challenge Bubbler describes sorting a list by inserting its elements left to right into a double ended queue or "deque". Take a number from the front of the array, and push it into ...
Wheat Wizard's user avatar
  • 99.1k
9 votes
4 answers
249 views

GolfScript many-items rotation

There isn't a builtin in golfscript which lets you rotate a bigger portion of the stack than the three top-most elements. It should take one number n as argument and rotate the nth value from the top, ...
Styleurcam's user avatar
11 votes
3 answers
226 views

Substring of Fizzbuzz

Decide if a string is substring of Fizzbuzz without separation 12Fizz4BuzzFizz78FizzBuzz11Fizz1314FizzBuzz.... Notice that it doesn't necessary cover whole tokens, ...
l4m2's user avatar
  • 25.2k
12 votes
9 answers
607 views

Simulate Text Cursor

You are given a string [A-Za-z|]+ that contains exactly one occurrence of | denoting the current position of the cursor and a ...
z..'s user avatar
  • 1,001
7 votes
9 answers
1k views

Braille-based Base64

Make a one-to-one map from the base64 character table(0-9a-zA-Z+/) to Braille(U+2800-U+283F). These characters are fixed map for compatibility. For other characters(aka. A-Z and +) you can map any ...
l4m2's user avatar
  • 25.2k
1 vote
0 answers
166 views

Shortest way to cause a seg fault at 0x9c?

In honour of CrowdStrike's exception at 0x9c, what's the shortest way (character-wise) to cause a segfault by dereferencing address 0x9c? The best I can come up with is: ...
0x9c's user avatar
  • 39
6 votes
4 answers
355 views
+50

Compute Dickman

Input A floating point number \$x\$ between 1 and 8 inclusive. Output The Dickman function of \$x\$. The Dickman–de Bruijn function \$\rho(u)\$ is a continuous function that satisfies the delay ...
Simd's user avatar
  • 3,114
3 votes
18 answers
325 views

Check if two lists are permutations of each other [duplicate]

Challenge Given two lists of equal length, find if one of them is a permutation of the other. Output truthy or falsy values, or 1 or 0. Test case Examples ...
Andy Liu's user avatar
  • 121
13 votes
15 answers
911 views

Reorder for smallest largest prefix sum

Given a multiset of integers, order them such that the largest absolute prefix sum $$\max_i \left| \sum_{k<i} a_k \right|$$ is smallest. Output any solution if multiple exist. You can assume input ...
l4m2's user avatar
  • 25.2k
18 votes
21 answers
5k views

Wait, ASCII was 128 characters all along?

Challenge In this challenge, you have to take a nonnegative integer as input, convert it into base-128 bytes (0 → 0x00, 127 → ...
squareroot12621's user avatar