Podcast #128: We chat with Kent C Dodds about why he loves React and discuss what life was like in the dark days before Git. Listen now.

Questions tagged [fewest-operations]

Fewest operations measures the number of specified "operations" performed at run time.

Filter by
Sorted by
Tagged with
23
votes
9answers
4k views

Fastest algorithm to take the product of all subsets

Given n numbers in an array (you can't assume they are integers), I would like to compute the product of all subsets of size n-1....
23
votes
2answers
899 views

Optimize sorting, using “Sub-vector reversals”

This is a fewest-operations challenge where the objective is to sort a vector into ascending order using the fewest reversals. Your algorithm can only sort the vector using "sub-vector reversals"1, ...
18
votes
1answer
407 views

Fewest disk writes to defrag multiple files

Introduction A disk is a linear container with blocks indexed 0 through size-1. A file is a named list of block indexes used ...
20
votes
4answers
569 views

Identify a string from its substrings

Introduction I've previously created two challenges where the idea is to reconstruct an object using as few query-type operations as possible; this will be the third. The task Your inputs shall be ...
25
votes
7answers
2k views

Find the Cheese

Update: There are 6 mazes. They are included in the controller. There is a tar.gz of the mazes and their .bmp files here (dropbox). There is also a utility for making more mazes at that link (the ...
15
votes
2answers
636 views

Image Hide-and-Seek

In this challenge, you need to find a specific pixel within an photograph (taken with a real camera). You are passed an (R, G, B) tuple and an image, and you need to return a point (x,y) within the ...
18
votes
1answer
352 views

Know a sequence by its subsequences

Introduction Suppose you and your friend are playing a game. Your friend thinks of some particular sequence of n bits, and your task is to deduce the sequence by ...
8
votes
3answers
640 views

Egg dropping contest

Your challenge: You are on the 0th floor of a infinitely tall building. At any floor, you can walk to the window and drop an egg. Your goal is to figure out the highest floor that the egg can ...
17
votes
4answers
1k views

An optimization challenge with strange coins

You have n coins which each weigh either -1 or 1. Each is labelled from 0 to n-1 so you can ...
17
votes
0answers
528 views

GOLF CPU - Implement Arbitrary Precision Integer Division [closed]

This question was inspired this question and @orlp's comment and a lot of the explanation was copied from there. Write a GOLF assembly program that given two arbitrary size decimal integers ...
5
votes
2answers
311 views

The GOLF CPU Golfing Challenge: Sides of a Cuboid

This challenge is the second of a series of fastest-code problems that should be written in the GOLF CPU. You can find the first here For this problem, you are given the volume of a cuboid (A ...
14
votes
2answers
521 views

The GOLF CPU Golfing Challenge: Prime Partitions

This challenge is the first of a series of fewest-operations problems that should be written in the GOLF CPU. You can find the next one here A partition of a number, ...
16
votes
4answers
597 views

Testing if a number is a square

Write a GOLF assembly program that given a 64-bit unsigned integer in register n puts a non-zero value into register s if ...
22
votes
3answers
2k views

Factoring a 64-bit integer

Write a GOLF assembly program that reads an integer from stdin (followed by a trailing newline), and outputs its prime factors seperated by newlines, followed by a trailing newline on stdout. The ...
16
votes
3answers
847 views

Reconstruct a Permutation

Introduction Suppose that you are handed a random permutation of n objects. The permutation is sealed in a box, so you have no idea which of the ...