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).
-3
votes
0answers
41 views
how to clear the space form and element ! [on hold]
when i change the height attribute of canvas tag in http://www.anthonyterrien.com/knob/ , for example in this section :
data-width="100"
data-displayInput=false
when i through the inspect element ...
10
votes
1answer
293 views
+50
An optimization version of the Hadamard problem
First, some definitions.
A Hadamard matrix is a square matrix whose entries are either +1 or −1 and whose rows are mutually orthogonal. The Hadamard conjecture proposes that a Hadamard matrix of ...
18
votes
4answers
1k views
Golfing strings in Fourier
Challenge
Given a string as input, golf down the Fourier program which outputs that string.
In Fourier there is no easy way to output a string: you have to go through each character code and output ...
2
votes
0answers
83 views
Num of pyramids possible with given number of bricks [closed]
I encountered this question in an interview and could not figure it out. I believe it has a dynamic programming solution but it eludes me.
Given a number of bricks, output the total number of 2d ...
11
votes
1answer
418 views
Lossless English language text compression challenge [closed]
Challenge:
Your challenge (should you choose to accept it) is to compress and decompress the 5MB "Complete Works of William Shakespeare" as found here:
...
-2
votes
1answer
175 views
Ich ne know pas [closed]
Challenge
You must write a program which correctly identifies the language a passage is written in.
Rules
The passage will be a string passed to your program either via STDIN or function arguments.
...
1
vote
3answers
420 views
Brainf*** code golf challenge - write a Brainf*** program that searches for the first non-zero cell
The challenge is to write a brainf*** program that searches sequentially through memory for the first NON-zero cell.
The program should start somewhere in fairly low memory (there will probably be ...
5
votes
0answers
328 views
Take It or Leave It III: A Game Show for Computers
This is the third in a series of puzzles that I will be posting every Monday at Midnight PST, and the final variant of "Take It or Leave It".
The first puzzle is located Here
The second puzzle is ...
13
votes
4answers
374 views
Find the largest independent set in a high-dimensional lattice-like graph
For a given positive integer n, consider all binary strings of length 2n-1. For a given string S, let L be an array of length n which contains the count of the number of 1s in each substring of ...
4
votes
1answer
369 views
Reflections in Water [closed]
Take a string as input. This string can be as long as you'd like, however, it may only include letters and spaces––no numbers, punctuation, etc. When a word is passed into your function, an image will ...
20
votes
7answers
3k views
Take It or Leave It II: A Game Show for Computers
This is the second in a series of puzzles that I will be posting every Monday at Midnight PST. The first puzzle is located Here.
Context:
A reclusive billionaire has created a game show to ...
28
votes
5answers
2k views
Take It or Leave It: A Game Show for Computers
Context:
A reclusive billionaire has created a game show to attract the world's best and brightest programmers. On Mondays at the stroke of midnight, he chooses one person from a pool of ...
6
votes
1answer
286 views
Cross platform… You wish
Write a program that will produce differing behaviors on as many different platforms as you can. Each differing platform awards one point (including an initial platform, meaning you can't score less ...
-6
votes
6answers
146 views
Deep thought: Levenshtein distance [duplicate]
So, blatantly plagiarizing from inspired by this challenge and its sequel, I thought I'd add another.
The text to match:
What do you get when you multiply six by nine
The result your ...
2
votes
2answers
645 views
A Kingdom Hearts VGM challenge
I'm a huge video game music fan. One of my favorite OSTs is that from Kingdom Hearts, by Yoko Shimomura.
The challenge
Create a program or function that takes two arguments in any format: an ...
1
vote
0answers
90 views
Minimizing Covering Arrays
This is the followup question to this previous CodeGolf question about Covering Arrays (the details of what Covering Arrays are and how they are formatted at the NIST website are there).
In this ...
12
votes
5answers
928 views
Code close to the challenge: Inception
This is a sequel to this challenge: Code close to the challenge: Sum of integers
The challenge in this one is a bit harder, and also makes for a cool title (Which is why I picked it):
Calculate ...
35
votes
16answers
3k views
Code close to the challenge: Sum of integers
This is a simple challenge:
Given a sequence of integers, find the sum of all integers in it.
But with a twist.
Your score is the Levenshtein distance between your code and the following phrase (The ...
30
votes
17answers
5k views
Holy Hole In A Donut, Batman!
Holy Hole In A Donut, Batman!
Some characters are more holy than others. Using as few unholy letters as possible, display the statement above.
Challenge
Write a full program to print Holy Hole In A ...
30
votes
2answers
1k views
Shortest universal maze exit string
A maze on an N by N grid of square cells is defined by specifying whether each edge is a wall or not a wall. All outer edges are walls. One cell is defined as the start, and one cell is defined as the ...
9
votes
5answers
633 views
Path of exile map combinations
This question will feature a mechanic from the game "Path Of Exile" in this game there are things called MAPS they are items that you can use to open high level areas, you can also combine 3 of them ...
9
votes
0answers
362 views
Lossy ASCII art compression
Background
PICASCII is a neat tool that converts images into ASCII art.
It achieves different degrees of brightness by using the following ten ASCII characters:
@#+';:,.`
We'll say that these ...
13
votes
6answers
905 views
A determinant optimization challenge
Consider 30 by 30 Toeplitz matrices all of whose entries are 0 or 1. This challenge is a simple optimization challenge to find the matrix with the largest determinant possible.
Input None
Output A ...
5
votes
2answers
260 views
Conversion to Boolean satisfiability
Given a matrix M all of whose entries are 0 or 1, we want to known whether there exists a non-zero vector v with each element in {-1, 0, 1}, such that Mv = 0.
An easy way to do this is just to try ...
5
votes
1answer
185 views
Most efficient table storage for determining recurrence
The goal of this challenge is to implement a storage and retrieval pattern that will most quickly determine if a set of recurrence definitions fall within a date range.
Consider the schema: Event ...
0
votes
2answers
240 views
Javascript function challenge add(1,2) and add(1)(2) both should return 3 [closed]
A friend of mine challenged me to write a function that works with both of these scenarios
add(1,2) // 3
add(1)(2) // 3
My instinct was the write an add() function that returns itself but I'm not ...
33
votes
8answers
5k views
40 Numbers in 9 Bytes
There are 40 ways a directed Hamiltonian path can be arranged on a 3×3 grid:
This graphic (thanks Sp3000!) shows only the 20 undirected paths. Traverse each colored line in both directions for ...
-4
votes
9answers
294 views
Generate and print the first 20 Fibonacci numbers with the least unique characters
As the title suggests, my task is fairly straightforward:
Write a program in your language of choice that will print out the first 20 Fibonacci numbers using the least unique characters.
For example ...
1
vote
1answer
200 views
Quine permutation group
Write a program or function which, when run, outputs another program or function which is valid in the same language as the original program, and which itself will output another program or function ...
25
votes
8answers
1k views
Uniquely separated pixels
For an N by N image, find a set of pixels such that no separation distance is present more than once. That is, if two pixels are separated by a distance d, then they are the only two pixels that are ...
16
votes
2answers
3k views
Prime Nerd Sniping Pattern
Longest day of the year - here's something to waste the extra time...
Overview
Note this is not a popularity contest and not a graphical output challenge - you are only required to output a string ...
17
votes
3answers
516 views
Stacking Pythagorean Triangles
Background
A Pythagorean triangle is a right triangle where each side length is an integer (that is, the side lengths form a Pythagorean triple):
Using the sides of this triangle, we can attach ...
34
votes
4answers
851 views
Build a one-word search generator
The word BANANA appears exactly once in this word search:
B A N A A N B B
A B A N A B A N
A N A B N N A A
N N B A A A N N
N A A N N N B A
A N N N B A N A
N A A B A N A N
B A N A N B B A
The word ...
42
votes
6answers
4k views
1 character typo generating most error messages from C++ compilation
It seems that simple changes to a C++ file, especially with templates, can generate pages of errors. This contest is to see what the largest "bang of the buck" is, that is the more verbose error ...
16
votes
5answers
660 views
Boggle Board Compression
When working on Non-Palindromic Polyglot Boggle, I found it quite tedious to pack the codes as efficiently as possible onto the Boggle board, even with only two strings. But we're programmers, right? ...
6
votes
2answers
401 views
Coding hex board game
Introduction
Hex is a strategy board game played on a hexagonal grid, theoretically of any size and several possible shapes, but traditionally as an 11×11 rhombus. Other popular dimensions are 13×13 ...
14
votes
1answer
831 views
Rearranging Words
You should write a program which receives two strings as input and outputs a sequence of movements which rearrange the first string into the second. You should use as few moves as you can.
Both ...
10
votes
1answer
445 views
Non-Palindromic Polyglot Boggle
Introduction
The number 101 is a palindrome, since it reads the same backwards and forwards. The number 105 is not. However, 105 in base eight is written as 151, which is palindromic. On the other ...
9
votes
2answers
244 views
Visit each drifting tracker
Your job is to replace the battery packs on many floating fish tracking
devices in the shortest time. You must leave your base in the base helicopter
and visit each tracker once, then return to the ...
0
votes
2answers
189 views
Make a valid error maker!
We've been twice challenged to make 'error quines' (see Make an error quine! and Make a slow error quine maker!), so why don't we try the opposite?
Instructions
Write a "program" that, when run, ...
21
votes
8answers
1k views
Make a slow error quine maker!
As part of his answer to Make an Error Quine!, @Falko proposed the following algorithm:
How to create your own solution in 2 minutes?
Open a new file in an IDE of your choice.
Bang your ...
1
vote
0answers
117 views
The polyglot challenge! [duplicate]
A polyglot is a program which can be run by several different language's interpreters/compilers without failing.
For example, the stackoverflow 404 page contains a polyglot which runs in Python, ...
13
votes
5answers
418 views
Print strings without sharing characters
Edit: Allowed to reuse whitespaces.
Your task is to write n programs (or functions, or bodies of functions without using parameters or the function names) in the same language. The kth program ...
11
votes
1answer
463 views
Build a poisoned wine testing scheduler
Recently at Puzzling.SE, there was a problem that I wrote about determining which two bottles out of a larger number are poisoned when the poison only activates if both components are drunk. It ended ...
18
votes
7answers
546 views
Optimize the Scralphabet
Scralphabet
A normal bag of Scrabble tiles contains the following letters (? is a blank tile, which can stand for any other letter):
...
7
votes
10answers
678 views
List Sophie Germain primes
The Question
A Sophie Germain prime is a prime p such that 2p+1 is prime as well. For example, 11 is a Sophie Germain prime because 23 is prime as well. Write the shortest program to calculate Sophie ...
12
votes
1answer
217 views
Express a number - a modern “Des Chiffres et des Lettres”
Express a number
Back in the 60s, the French invented the TV game show "Des Chiffres et des Lettres" (Digits & Letters). The goal of the Digits-part of the show was to come as close as you can to ...
4
votes
4answers
508 views
Many programs, few characters
Your task is to create many programs. The first outputs 1, the second outputs 2, etc. The higher you can go, the better!
However, all of these programs must be made the same list of characters. You ...
15
votes
6answers
391 views
Princely Prefix by a Program in Pattern
You should write a program or function which outputs or returns as much of Chapter I of The Little Prince as it can. Your program or function has to be an M-by-N block of code containing only ...
43
votes
125answers
4k views
Evolution of OEIS
In this challenge, the goal is to recreate the On-Line Encyclopedia of Integer Sequences one sequence at a time. Similar to the Evolution of Hello World, each answer depends on a previous answer.
...