for challenges involving optimizing a certain thing.

learn more… | top users | synonyms

11
votes
2answers
253 views

Creasing for Loot

Introduction After a long battle, you have managed to defeat a Sphinx in a contest of riddles. The Sphinx, impressed with your skill, wishes to give you a reward commensurate with your cleverness, ...
16
votes
1answer
573 views
+150

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 ...
13
votes
6answers
883 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 ...
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 ...
2
votes
1answer
182 views

Minimum of a Polynomial in Python

What is the shortest amount of code that can find the minimum of an inputted polynomial? I realize that you can import packages like Numpy and others, but using only user defined functions, what is ...
18
votes
7answers
539 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): ...
-2
votes
4answers
206 views

Write a program that takes as close to 1 second sharp to execute in your language [closed]

Write a program that takes as close to 1 second Wall-time sharp to execute in your language. Anything goes except to have the processor sleep / pause / wait, by either internal or relying on external ...
9
votes
4answers
501 views

Build a minimum-clue Sudoku unsolver

My attempt at stating this question, but with a more objective solving criterion. Your task is to build a program or function that takes a solved Sudoku grid S in the format of your choice and ...
14
votes
2answers
546 views

Build a top-front-side puzzle solver

A top-front-side puzzle is a puzzle where you are required to construct a 3-D shape of (usually cubic) blocks given three orthogonal views: a top view, a front view, and a side view. For example, ...
6
votes
2answers
352 views

Implement multiplication by a constant with addition and bit shifts

While looking at the ARM instruction set, you notice that the ADD instruction has the so-called "Flexible second operand", which can be abused for quick multiplication. For example, the following ...
4
votes
0answers
321 views

Tetris Tangrams

Introduction Tangrams are a classic puzzle involving arranging/fitting blocks into various shapes. From the Chinese 七巧板 - literally meaning "seven boards of skill". Let's take this idea and use the ...
4
votes
7answers
293 views

Fastest array-by-array nearest neighbour search

Intro - Nearest neighbour comparison between two arrays is something that can be done very efficiently when only 1 variable per array is involved, because it can be done by sorting and then performing ...
43
votes
8answers
7k views

Is this even a word?

Your should write a program or function that takes a 4-character string as input and outputs a value indicating if the string is an English word or not. You are allowed to make mistakes in 15% of the ...
13
votes
2answers
777 views

Go and make it starry

In this contest you have to write a program, that accepts a black and white pixel image, and tries to alter it, such that the white shape forms star domain, with as few changes as possible. Allowed ...
1
vote
0answers
121 views

0h h1: Logical optimization [closed]

I've written a recursive backtracking solver for the game 0h h1. It's a simple game that takes place on a square grid, and each cell can be empty, red, or blue. You are given an initial configuration, ...
5
votes
1answer
269 views

Crafting Canonically Cöcher Crosswords

The Setup Most of us are familiar with crossword numbering, which follows three basic rules: in a character grid consisting of blacks and whites (see below), any maximal contiguous horizontal or ...
10
votes
4answers
979 views

5 Seconds to Find Pie

Pi times e (or Pie if you like ambiguous notation) to 100 decimal places is: 8.5397342226735670654635508695465744950348885357651149618796011301792286111573308075725638697104739439... (OIES A019609) ...
8
votes
1answer
506 views

Frogger Champion

The Game Most of us know about Frogger, the 80's era arcade game where the objective is to hop a frog safely across a busy highway and a hazard-filled pond to arrive safely at home. A challenge was ...
7
votes
3answers
922 views

Restricted memory optimization

The edit (or Levenshtein) distance between two strings is the minimal number of single character insertions, deletions and substitutions needed to transform one string into the other. If the two ...
27
votes
1answer
1k views

Domino Circuits

Scoreboard Here are the raw scores (i.e. domino counts) for VisualMelon's submission. I'll turn these into the normalised scores described below, when more answers come in. The existing solution can ...
-1
votes
2answers
254 views

Shortest test for primality for byte [duplicate]

Write a function which gets as input a number (0 <= n <= 255) stored in 32-bit variable and returns non-zero integer if n is prime number and 0 otherwise. Considern = 0 and n = 1 as non-primes. ...
18
votes
2answers
2k views

Mastermind strategy

I could only find code-golf challenges for Mastermind, so here's a code-challenge version that I would have liked to take on myself. An optimal strategy for the normal Mastermind game, MM(4,6), was ...
12
votes
4answers
801 views

Travelling Salesman

You are given, as a list or vector or whatever, a bunch of 3-tuples or whatever, where the first two things are strings, and the third thing is a number. The strings are cities, and the number is ...
1
vote
3answers
1k views

Check If Two or More Variables Are All Equal to Zero in JavaScript

What is the shortest way to check if two or more variables are equal to 0 in JavaScript? I'm curious to know if there's something shorter than if(!x&&!y&&!z){...}.
2
votes
2answers
526 views

Saying a number in the shortest way

A string of digits (positive integer) can be converted to plain English in various ways. For instance, 115 can be read as "hundredfifteen", "oneonefive", "elevenfive", "twoonesfive". So question's ...
7
votes
4answers
455 views

Build a drug testing scheduler

In this problem on Puzzling.SE, I ask a question about determining the amounts of drug to use in a clinical test to minimize total drug usage and fulfill the requirements of the testing procedure. ...
4
votes
0answers
111 views

Using dictionaries, thesauruses, and similar databases, construct as large of a “See also” loop as possible [closed]

As I'm sure many of you know, synonyms can range from very similar to not-so-similar-but-I-can-see-how-it's-similar. It's common for dictionaries to use "See also" to denote occurrences of words that ...
42
votes
1answer
1k views

Minimal keystrokes needed to type a given text

We all know that programmers tend to be lazy. In order to maximize your free time, you decide to write a program that outputs a minimal number of keystrokes for text fed into it. Input: Text that ...
5
votes
2answers
493 views

Build a program that creates a minimal one-ohm resistor diagram for a given resistance

You are a contractor for a company who designs electrical circuits for the various products they make. One day, the company accidentally gets a huge shipment of one-ohm resistors and absolutely ...
10
votes
2answers
815 views

Implement superoptimizer for addition

The task is to write code that can find small logical formulae for sums of bits. The overall challenge is for your code to find the smallest possible propositional logical formula to check if the sum ...
6
votes
3answers
627 views

Who brings the croissants?

This question is inspired by a similar question first asked on StackOverflow by Florian Margaine, then asked in variant forms on CS by Gilles and on Programmers by GlenH7. This time, it's a code ...
-2
votes
1answer
129 views

meeting point minimizing travel distance for participants? [closed]

The problem is to find the point minimizing the travel distance for around 100 persons in different regions who want to meet in the same place. Travel is by car not by plane. Assuming that I get ...
8
votes
0answers
606 views

Shortest 2-Player Game of Halma

In Chess, it's possible for the game to end after 4 moves (2 each) with a Fool's Mate. Your goal is to find the Fool's Mate of Halma: the 2-player game of Halma that minimises the number of turns ...
14
votes
2answers
1k views

Compact a Befunge program

Befunge is a 2-dimensional esoteric programming language. The basic idea is that (one-character) commands are placed on a 2-dimensional grid. Control flow walks across the grid, executing commands it ...
2
votes
1answer
217 views

Bob's Financial Planning (Maximize)

Bob's Financial Planning Bob lives in Pecunia. It is a small island city completely governed by the Pecunia City Council (PCC). PCC has decided to encourage foreign investments in the city by waiving ...
10
votes
4answers
1k views

Program my microwave oven

I'm very lazy so I try to always program my microwave with the fewest possible button presses. My microwave has the following buttons: A "minute plus" button which may only be pressed first and ...
-2
votes
1answer
467 views

The real knapsack problem [closed]

Given the number of goods N positive weight of each good weight[N] positive profit of each good profit[N] and a positive number W which is the knapsack capacity. This problem is called “the ...
3
votes
1answer
434 views

Minimum number of transactions so everyone has paid the same [closed]

On a road trip, N people pay for fuel. Each pays a different amount. At the end of the trip, calculate the minimum number of transactions so that each person has paid the same amount. e.g. on the ...
1
vote
1answer
376 views

How can I make this program smaller? [closed]

I am trying my hand at writing super small programs. I wrote a simple "tree" display program for showing a graphical representation of a folder hierarchy. I have made it small in all the ways I can ...
0
votes
1answer
195 views

Reduce the amount of loops when finding if an element is stored only once in the array? [closed]

I was amazed to find that there is a way to reduce the times you loop on an array to find if a element is contained once. One would think that the only way would be to loop through the whole array, ...
3
votes
3answers
1k views

Fastest python implementation of multiplication table

I'd be interested to see who can come up with the fastest function to produce multiplication tables, in the following format: 1 2 3 4 5 6 7 8 9 10 11 12 2 4 6 8 10 12 ...
5
votes
3answers
365 views

Organize a tournament

Here is a real question somebody asked me. Suppose you have n teams, one terrain. Each team must play each other team exactly once. The number of times a team plays two matches in a row should be ...
4
votes
1answer
415 views

Add two vectors modulo 5

Interpret a triple of 32-bit integers as a vector of 32 integers modulo 5. Write an addition routine for these vectors. Example: def add32((a0,a1,a2),(b0,b1,b2)): c0 = c1 = c2 = 0 m = 1 ...
5
votes
1answer
626 views

Help at an IOI problem! [closed]

I'll participate in IOI 2011 this year, and I'm solving past IOI problems in order to get properly prepared. This problem is quite difficult. A binary search which uses two guesses to provide a ...
12
votes
2answers
1k views

Fastest python code to find a set of winning words in this game

This is a word game from a set of activity cards for children. Below the rules is code to find the best triplet using /usr/share/dict/words. I thought it was an interesting optimization problem, and ...
8
votes
13answers
658 views

Numbers, Sums, Products

Given a 20×20 grid of non-negative integers, find a 3×3 sub-grid where the product of the sums of the individual lines hits the maximum. Spoken in formulas: Given the 3×3 sub-grid the function to ...