Fastest-algorithm competitions are won by the answer with the smallest asymptotic time complexity. For challenges based on actual runtime, use [tag:fastest-code] instead.

learn more… | top users | synonyms

2
votes
0answers
167 views

Add or subtract numbers to find the smallest non-negative integer [closed]

Given a positive integer, n, along with n non-negative integers, write a program or function that prints or returns the smallest non-negative integer that can be obtained by additions and subtractions ...
9
votes
1answer
155 views

Number of unique outputs by substituting variables

Given a set of formulas like this: bacb bcab cbba abbc Give an algorithm that finds the number of unique results you can get when each variable is substituted for either "0" or "1" in every ...
6
votes
1answer
90 views

Determine sets of associatively equivalent permutations of commutative operations

There are many types of binary operations, which can be categorized by their associative properties and their commutative properties. A binary operation () is associative if the order of operations ...
8
votes
2answers
353 views

Fastest way to compute order of magnitude in x86 assembly

The task is simple: write assembly that computes the order of magnitude of an integer using as few clock cycles as possible. Order of magnitude is defined as log10, not log2. The range of valid ...
0
votes
0answers
75 views

Find the longest recurring substring [duplicate]

Given a string of no more than 255 characters, find a function that returns the longest recurring substring. An example would be: aabbacadeauaaabba where the longest recurring sub-string is ...
-2
votes
2answers
173 views

Find Anagrams in the Dictionary [closed]

This a code challenge. The winner will be the person to provide the most efficient implementation of the solution in terms of algorithmic complexity. Using the dictionary found in '/usr/share/dict' ...
10
votes
2answers
667 views

A fastest algorithm optimization challenge

This is my first experiment with an asymptotic complexity challenge although I am happy with answers entirely in code as long as they come with an explanation of their time complexity. I have the ...
0
votes
1answer
714 views

Determine the move in which a LOGO turtle crosses a point that it has already visited

Situation: A turtle starts at (0, 0) on a cartesian graph. We have a non-empty zero-indexed "moves" list that contains numbers. Each number represents the distance moved. The first number is the ...
5
votes
9answers
2k views

Same word when missing letters

Idea From a given word dictionary (containing only plain letters, i.e: no accent or other special chars), with a given fixed word length, find every same when a given number letters are missing. For ...
4
votes
6answers
668 views

Mr. Moneybag's Money Piles

Mr. Moneybags is a very rich man. He has an assistant Mr. Perfect, who one day, got very mad, and shredded some of Mr. Moneybag’s $100 bills! Mr. Moneybags decided to punish Mr. Perfect. Mr. ...
1
vote
1answer
507 views

Racketeer Taxi Driver

The Scenario You are a taxi driver in your city. You picked up a passenger from the airport and he told you the place he'd like to go. To earn more money, you need to drive as much as you can. ...
4
votes
3answers
228 views

Autoscale complex function

Context: We are working on a complex image drawing program to produce mugs, t-shirts, and so on. Here is an example of such function However, we are facing the following problem: Random generated ...
6
votes
7answers
1k views

Count the Zeros

For a given n, count the total number of zeros in the decimal representation of the positive integers less than or equal to n. For instance, there are 11 zeros in the decimal representations of the ...
8
votes
7answers
794 views

Count the number of cyclic words in an input

Cyclic Words Problem Statement We can think of a cyclic word as a word written in a circle. To represent a cyclic word, we choose an arbitrary starting position and read the characters in ...
1
vote
4answers
626 views

Tricky Median Question

Given n points, choose a point in the given list such that the sum of distances to this point is minimum ,compared to all others. Distance is measured in the following manner. For a point (x,y) all ...
8
votes
6answers
1k views

Code-Challenge:The Nearest Prime

Challenge In this task you would be given an integer N you have to output the nearest prime to the integer. If the number is prime itself output the number. The input N is given in a single ...
4
votes
4answers
724 views

Code-Challenge: Farey sequence (II)

Challenge In this task you would be given an integer N (less than 10^6), output the number of terms in the Farey sequence of order N. The input N is given in a single line,the inputs are ...
10
votes
5answers
1k views

Free a Binary Tree

So before you read some basic computer science concepts. A binary tree is a dynamically allocated structure (usually used for ordered storage). Because of its nature traversal of binary trees is ...