Skip to main content

Questions tagged [optimization]

For challenges focusing on the optimization of an aspect not covered by other tags. (not a winning criterion)

Filter by
Sorted by
Tagged with
18 votes
3 answers
993 views

Here is a game: Start with the set {1,2,3,...,n} of natural numbers. At any turn of the game, you may pick two numbers from this set, a and b, then replace them with their product a*b. Since it is a ...
Fabius Wiesner's user avatar
17 votes
6 answers
2k views

inspired by this post. Consider 2 coworkers who work Monday - Friday, every week of every year, with no breaks or national holidays. On day n (day, month and year), worker 1 asks worker 2 their ...
Themoonisacheese's user avatar
22 votes
2 answers
2k views

The task is to find parameters that make a fast leap year check correct for the widest range of years. We assume the Proleptic Gregorian calendar, which extends the Gregorian calendar backward from ...
Falk Hüffner's user avatar
0 votes
2 answers
292 views

Challenge This challenge is based on the domino effect: Initially, each domino is located on one straight line and is in a vertical state. It can be dropped either to the left along the same straight ...
Michael's user avatar
  • 11
4 votes
5 answers
1k views

Here is a challenge: What is the shortest possible compiled program? Writing one line programs are fun, but they often lean on language libraries that get pulled into the final bits. How lean can you ...
Roger Hill's user avatar
17 votes
19 answers
6k views

The bots are looking for love. Can you help them? The rules The goal of this game is find the bot you have the highest compatibility with. However, robots, who are inexperienced at dating are unable ...
mousetail's user avatar
  • 14.4k
6 votes
2 answers
1k views

In this game, you can look inside one box at a time chosen by you. When you do that, you can see how many coins there are in that box. The wizard has one last twist for you. At any point, you can ...
user avatar
6 votes
1 answer
2k views

This challenge requires integration with C, so you can stop reading if you're not interested. Matrix multiplication is a simple operation, but the performance depends a lot on how efficiently the code ...
xiver77's user avatar
  • 2,395
19 votes
8 answers
2k views

Given a string, like potatocarrot, break it into the smallest number of substrings possible. These substrings can consist either be a single character, or one of a ...
rydwolf's user avatar
  • 19.3k
15 votes
12 answers
2k views

There are times when a large number of people need to choose something. They all want to get the stuff they choose, obviously, but it's impossible to please everyone that way, so a usual compromise is ...
ophact's user avatar
  • 3,184
22 votes
4 answers
812 views

An "Egyptian fraction" is a list of distinct fractions with a numerator of \$1\$. For example: \$ \frac 1 1+ \frac 1 2 + \frac 1 3 + \frac 1 6 \$ The "size" of an Egyptian ...
Wheat Wizard's user avatar
  • 103k
32 votes
10 answers
5k views

You may know the game The Six Degrees of Kevin Bacon, based on the conjecture that every actor in Hollywood can be connected to Kevin Bacon by no more than 6 "co-star" relations, so Kevin ...
pxeger's user avatar
  • 25.3k
26 votes
27 answers
3k views

Story My local pizza delivery introduced new discount. You get 50% discount from every second item on your order. But being greedy capitalists, they forgot to mention that they will rearrange items ...
talex's user avatar
  • 927
18 votes
7 answers
1k views

This code-challenge is based on OEIS sequence A261865. \$A261865(n)\$ is the least integer \$k\$ such that some multiple of \$\sqrt{k}\$ is in the interval \$(n,n+1)\$. The goal of this challenge is ...
Peter Kagey's user avatar
  • 8,145
2 votes
0 answers
79 views

Here's an interview question I've seen on a few sites. People claim that an O(n) solution is possible, but I've been racking my brain these last 2 days and I couldn'...
Ram Rachum's user avatar
19 votes
1 answer
1k views

The challenge How well can you gerrymander North Carolina into 13 voting districts? In this challenge, you use the following files to draw different maps for Republicans and Democrats. File 1: ...
Dustin G. Mixon's user avatar
18 votes
1 answer
1k views

The previous neural net golfing challenges (this and that) inspired me to pose a new challenge: The challenge Find the smallest feedforward neural network such that, given any 4-dimensional input ...
Dustin G. Mixon's user avatar
18 votes
14 answers
2k views

Given a \$n\$-dimensional vector \$v\$ with real entries, find a closest permutation \$p\$ of \$(1,2,...,n)\$ with respect to the \$l_1\$-distance. Details If it is more convenient, you can use ...
flawr's user avatar
  • 44.1k
6 votes
1 answer
712 views

Given two numbers in tape location #0 and tape location #1 in Brainfuck, compute their product into another tape location (specify with answer). Optimize for the least amount of time-units used, where ...
w33z8kqrqk8zzzx33's user avatar
31 votes
2 answers
1k views

Background Recognizing primality seems like a poor fit for (artificial) neural networks. However, the universal approximation theorem states that neural networks can approximate any continuous ...
A. Rex's user avatar
  • 2,617
17 votes
3 answers
1k views

Background The traveling salesman problem (TSP) asks for the shortest circuit that visits a given collection of cities. For the purposes of this question, the cities will be points in the plane and ...
A. Rex's user avatar
  • 2,617
16 votes
3 answers
587 views

This tweet lists the possible orders for Wings of a Chinese restaurant1: When ordering Pizza I usually calculate what size gives me the best Pizza-price ratio which is a simple calculation. However ...
ბიმო's user avatar
26 votes
2 answers
1k views

Description Imaginary programming language (IPL) uses Polish Reverse Notation. It has the following commands: i -- input number and push it to the stack o -- non-destructive output top of the stack (...
Андрей Ломакин's user avatar
21 votes
11 answers
2k views

Your mission is to build an algorithm (program or function) that can optimize packing fruit from a conveyor belt into bags to be sent off to retailers, optimizing for a largest number of bags. Each ...
Angs's user avatar
  • 5,017
11 votes
2 answers
598 views

Inspired by The Great API Easter Egg Hunt! Summary Your task is to search for a predetermined integer in the "Collatz space" (to be explained later) using the fewest step possible. ...
Weijun Zhou's user avatar
  • 3,657