All Questions

-1
votes
0answers
16 views

All possible paths a knight can take on a chess board during n turns

Challenge: Make a function in a programming languge which takes in as a parameter a knight's position on a chess board and a number of turns and returns all possible paths it can take during that ...
2
votes
0answers
16 views

Golf Paterson's Worms

Paterson's worms are a kind of cellular automaton that exist on an infinite triangular grid and, every step, they turn in some direction and move one unit. Their defining properties are that they can ...
1
vote
9answers
36 views

Find the number of leading zeroes in a 64-bit integer

Problem: Find the number of leading zeroes in a 64-bit signed integer Rules: The input cannot be treated as string; it can be anything where math and bitwise operations drive the algorithm The ...
0
votes
0answers
41 views

Find Lowest Positive Number not in Array [on hold]

Given an array of positive and negative integers, find the next lowest positive integer that was not contained in the array. Example: ...
11
votes
27answers
373 views

String rotation - output string repeatedly moving first character to the end

The challenge here is to take a string and output all its rotations, by repeatedly moving the first character to the end, once per character in the string, ending with the original string: ...
15
votes
4answers
322 views

Doubled-letter steganography

Steganography hides a given message inside a given carrier, producing a package that does not look suspicious. For this challenge, you will write a program that takes an ASCII message and an ASCII ...
15
votes
5answers
308 views

Satisfying Rounding

Satisfying Rounding You know when you're in science class, and asked to round to 2 sig figs, but your answer is 5.2501...? You should round to ...
1
vote
0answers
45 views

Bracket checking [duplicate]

Consider a string like: a.push(c.push("a",["ad","bd",2,{"ard",duo}]).pop().replace(2,"tg").enc([3,{2,adf},"atr"],5) Write a program that will verify whether a ...
20
votes
48answers
2k views

P Pr Pre Pref Prefi Prefix Prefixe Prefixes

Given some finite list, return a list of all its prefixes, including an empty list, in ascending order of their length. (Basically implementing the Haskell function ...
29
votes
22answers
4k views

Number that can eat itself

Given a positive integer, output a truthy/falsy value as to whether the number can eat itself. Rules Leftmost is the head, rightmost is the tail If the head is greater than or equal to the tail, ...
9
votes
9answers
329 views

Map the cheaters!

After all assignments are submitted, a dictionary is created that maps student number to the hash of their file. This dictionary, or hashmap, or mapping (whatever your language calls it) will look as ...
18
votes
6answers
2k views

Walk Across a Keyboard

Given a word (or any sequence of letters) as input, you must interpolate between each letter such that each adjacent pair of letters in the result is also adjacent on a QWERTY keyboard, as if you ...
-3
votes
6answers
116 views

Measuring Mountains [duplicate]

Sum-It is a language I created (quite late) for the Language Design Contest in TNB, for which the theme was "Range". Naturally I interpreted this as "Mountain Range" and created a language about ...
1
vote
0answers
93 views

Algorithm to print the Minimum number of adjacent character swaps necessary to remove all instances of “VK” in a given string? [on hold]

For example, how many adjacent swaps are at least needed to convert some string such as bvvkcv to one without any instances of ...
2
votes
0answers
118 views

Find what a phrase with removed letters originally said in fewest characters [on hold]

Write a program that, given a string of capital letters, output all possible phrases that could have been written originally, using any variant of the Oxford English Dictionary. Input There are two ...
42
votes
16answers
5k views

“As we travel the universe…”

You'll be given the name of one of the 20 biggest objects in the Solar System. Your task is to return an approximation of its radius, expressed in kilometers. This is a code-challenge where your ...
7
votes
11answers
2k views

Color of a Pixel

Write a program that prints the RGB color of a given pixel on the screen. The program should read a line from stdin in the format x,y, where x and y are unsigned ...
-4
votes
0answers
132 views

NPC transforming [closed]

Solve TSP(Shortest loop that each vertex is reached once per loop). You're given an oracle(blackbox function) that solves maximum independent set(Largest vertex subset that each pair are not connected)...
9
votes
1answer
395 views

Golf a number bigger than Loader's number

As a follow up to Shortest terminating program whose output size exceeds Graham's number and Golf a number bigger than TREE(3), I present a new challenge. Loader's number is a very large number, ...
-2
votes
0answers
44 views

Simple pseudorandom permutation for bytes [closed]

I'm looking for an implementation for a function f that: takes as input a byte and returns as output another byte is a permutation of the 256 possible values 0, 1, ..., 255 of a byte makes use of ...
19
votes
24answers
2k views

Digital Sumorial

Given an input n, write a program or function that outputs/returns the sum of the digital sums of n for all the bases 1 to ...
11
votes
10answers
2k views

Computer Cipher

Introduction: I have loads of different ciphers stored in a document I once compiled as a kid, I picked a few of the ones I thought were best suitable for challenges (not too trivial, and not too ...
-5
votes
1answer
130 views

Diagonal of a cube [closed]

Given the measurement of the edge of a cube, output the 3D diagonal measurement of it. Valid input and output formats are all the usual ones. There will be no winner answer as it by language code ...
7
votes
1answer
288 views

Fully Modular C: Grading

You are a Computer Science professor teaching the C programming language. One principle you seek to impart to the students is modularity. Unfortunately, past classes have tended not to get the message,...
0
votes
0answers
72 views

Restore the sequence [closed]

Given a sequence of distinct integers. In each step, a group of zero or more integers (not necessarily contiguous) change their positions. This process is repeated for 5 times. An integer moves only ...
18
votes
26answers
1k views

Make a simple word wrapper

(Note: This is my first ever code golf question, but as far as I can tell, nobody else has done exactly this, so I should be good.) Your task is to make a program or function that takes in a string <...
12
votes
5answers
237 views

Conjugation in Real Life

In @Adám's Dyalog APL Extended, the (under) operator means conjugation: apply one function, then a second function, then the inverse of the first. It's fun to ...
-2
votes
0answers
67 views

Writing polyglot for Esolang? [closed]

How could you write a polyglot in a way that, if ran by brainfuck will give output as brainfuck and ran by piet will give output as ...
18
votes
4answers
703 views

Prime containment numbers (speed edition)

This is sequence A054261 The \$n\$th prime containment number is the lowest number which contains the first \$n\$ prime numbers as substrings. For example, the number \$235\$ is the lowest number ...
21
votes
14answers
2k views

Prime containment numbers (golf edition)

This is sequence A054261. The \$n\$th prime containment number is the lowest number which contains the first \$n\$ prime numbers as substrings. For example, the number \$235\$ is the lowest number ...
-5
votes
18answers
465 views

Print a square!

Print this text: _________ | | | | | | |_________| Shortest code wins. Notice the space at the start of the first line.
21
votes
17answers
2k views

Split Mark's marks

Challenge Mark is a student who receives his N marks in a concatenated way in a one single line. The challenge is to separate his marks, knowing that each mark ...
13
votes
26answers
1k views

Self-contained powers

Given integer n, output the smallest exponent e greater than 1 such that n^e contains ...
13
votes
20answers
1k views

Number in Number-squared

Consider a sequence of natural numbers for which N appears as a substring in N^2. A018834 Output the nth element of this sequence. Rules Program takes only ...
19
votes
36answers
2k views

Given an input, print all exponents where the base and power sum to the input

So this is my first challenge on this site. What this challenge is is that you input a number, and your code spits out numbers which can be calculated as an exponent. The sum of the exponent and base ...
12
votes
10answers
995 views

Convert an Excel date code to a “date”

Given a non-negative integer Excel-style date code, return the corresponding "date" in any reasonable form that clearly shows year, month, and "day". Trivial, you may think. Did you notice the "scare ...
18
votes
9answers
1k views

Partitioning the grid into triangles

Goal The goal of this challenge is to produce a function of n which computes the number of ways to partition the n X 1 grid ...
15
votes
7answers
828 views

Lazy word problems

Summary A teacher was told to prepare word problems for the students. She is given a list of equations and told to write them as the corresponding word problem. However, she is very lazy, so she ...
0
votes
0answers
88 views

Count the score of a Code Golf code [duplicate]

My challenge is to make a Java method(s) that is given a String (another code in Java), removes any unnecessary characters, counts and returns the score, and displays the cleaned-up code in a way that ...
15
votes
5answers
1k views

How many moves?

Given two different positions on a chess board and the type of piece, output the minimum number of moves it will take for that piece to go from one position to another. Rules The given piece can be ...
15
votes
15answers
1k views

Weight of the Least Weighted RoD Path

Let A be an m by n rectangular matrix of positive integers, where ...
12
votes
1answer
212 views

Densely packed decimal (DPD) to decimal, with logic gates

Inspired by recent popularity of nandgame on TNB, and my own previous challenge. Background Densely packed decimal (DPD) is a way to efficiently store decimal digits in binary. It stores three ...
5
votes
5answers
127 views

Fibonacci with n numbers instead of 2 [duplicate]

How to Given an integer n start with n ones (i.e. 4 -> 1 1 1 1). Then sum up the last ...
9
votes
4answers
658 views

ASCII art H trees

An H tree is a fractal tree structure that starts with a line. In each iteration, T branches are added to all endpoints. In this challenge, you have to create an ASCII representation of every second H ...
3
votes
2answers
185 views

Special quines and code golf, hooray!

Make a quine. Simple enough, except it has to be a palindrome and accept input. Now, any side of a palindromic quine is one half of it. For example, one side of the hypothetical quine AAAA is AA. One ...
24
votes
14answers
3k views

How frustrating is my movie?

My parents have an home theater device. The remote is broken making it incredibly difficult to navigate rightwards in a menu. Most the time it doesn't work but when it does it moves rightwards ...
8
votes
2answers
139 views

Let's play Peg Solitaire

Peg solitaire is a popular game usually played alone. The game consists of some number of pegs and a board which is divided into a grid - usually the board is not rectangular but for this challenge we ...
3
votes
14answers
302 views

Create a kind of quine, such that the program prints one character of itself, then two, then three and so on

Create quine variant such that the program prints its first character, then the first two, then three and so on until the whole program is printed. Example Suppose your code is ...
12
votes
29answers
1k views

Nth subset of a set

The task Given the set $$S = \left[{1,2,3,4,5,6,7,8}\right]$$ and an integer $$0 \leq N < 2^{|S|}$$ find the Nth subset. Input/Output N is given as an unsigned integer on stdin. You must ...
7
votes
4answers
305 views

Sort a list, poorly

Don't you hate it when you're trying to roughly sort a list based on user data, but you have to poll the user for thousands of comparisons? Hate no more, because the answers to this challenge are (...

15 30 50 per page