All Questions

14,141 questions
Filter by
Sorted by
Tagged with
45 views

Make a GCSE student's error work

A GCSE computer science student recently made this hilarious blunder on their exam and posted it online. Now, you must make it work: ...
• 307
253 views

Do something you can't do in Brainfuck

Goal Do some action (like delete a file, connect to a server, …) that you can not do in standard Brainfuck. What As you know, all calculations you can do in almost any programming language you can ...
1k views

Cubic Concatenation

Challenge Given three non-negative integers $a, b$ and $c$, decide if the sum of their cubes is equal to the concatenation of those numbers, aka: $$a^{3}+b^{3}+c^{3} = a^\frown b ^\frown c$$ ...
• 399
80 views

Write a small simple compiler that translates mark-up language tabls into HTML tables [closed]

If you wrap data items in quotation marks and consider Wikipedia markup language (also known as wikitext, or wikicode) we have the following ASCII art table... ...
796 views

Lexicographically earliest permutation of the initial segment of nonnegative integers subject to divisibility constraints

The challenge is simple: Reorder the first integers {0, 1, 2, ..., n} into an ordered list so that the following three conditions are met: If k is the last element in the list, then all of its prime ...
• 231
981 views

Is this a valid Irish word?

In Irish, most consonants are divided into broad (velarized) and slender (palatalized) variants, and the orthography marks them with neighboring vowels, which are similarly divided. This gives rise to ...
• 3,188
209 views

Counterexample to Shapiro inequality

Input: A positive integer n such that n is even and greater than 12 or n is odd and greater than 23. Output: A list of non-negative integers that violates Shapiro inequality. More precisely, Let s be ...
97 views

Compress ascii images using run length encoding [closed]

Question: You need to implement two functions: one for compressing ASCII art using Run-Length Encoding (RLE) and another for decompressing RLE-encoded ASCII art. Problem Description Run-Length ...
773 views

Automatic Pikmin Count

Inspired by the feature in Pikmin 4. In Pikmin 4, you can have up to eight types of pikmin in an onion and up to three types of pikmin outside the onion. Each area recommends three types of pikmin to ...
• 2,973
448 views

Rabinowitz-Wagon $\pi$ formula

In 1995, Stanley Rabinowitz and Stan Wagon found an interesting algorithm to generate the digits of $\pi$ one by one without storing the previous results. The algorithm is called the spigot ...
• 49k
2k views

Three up to 800 & sum to 2048

(Flexibly) output 3 random integers such that: Each number is 1 to 800 inclusive Their sum is ...
• 512
2k views

Given a finite sequence, each of its elements has a first occurrence. Your task is to output the symbol whose first occurrence is last in the sequence. If the elements represent posts and reposts of ...
• 1,005
677 views

• 6,221
2k views

Reduce a string up to idempotency [closed]

Objective Given a string consisting of printable ASCII characters (!0x21 ― ~0x7E), treat it as an element in the free idempotent ...
• 6,221
177 views

How comparison-heavy is this list? [closed]

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 & ...
• 12.5k
489 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 ...
• 99.3k
718 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, ...
• 123
1k views

Substring of Fizzbuzz

Decide if a string is substring of Fizzbuzz without separation 12Fizz4BuzzFizz78FizzBuzz11Fizz1314FizzBuzz.... Notice that it doesn't necessary cover whole tokens, ...
• 25.6k
2k 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 ...
• 1,151
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 ...
• 25.6k
204 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: ...
• 49
588 views

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 ...
• 3,133
380 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 ...
• 121
995 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 ...
• 25.6k
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 → ...
2k views

Sorting with a deque

You're given an array of positive integers. Your job is to sort them using an initially empty deque (double-ended queue) by the following procedure: Take a number from the front of the array, and ...
• 78.1k
91 views

Calling functions and addressing arrays without operators [closed]

Is there a language where they write just ai for a[i] and sqrt2 for sqrt(2). I mean that arrays are treated like functions and calling a function does not need an operator.