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.
1
vote
0answers
129 views
Digital River (Shortest And Fastest Solution)
This is my first question, so I hope it goes well.
Background:
It's not the rivers that you might be thinking about. The question revolves around the concept of digital rivers. A digital river is a ...
-1
votes
1answer
215 views
Find the digit occurring the most in a range of prime numbers
Find the digit which occurs the most in a range of prime numbers.
Input:
Two numbers, p and q, specifying the range; the range includes both p and q.
Output:
The digit that occurs most frequently ...
2
votes
0answers
110 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 ...
-8
votes
1answer
104 views
Hard Puzzle Game Solver [closed]
There is an app called Hard Puzzle which is a game where there is a red circle, and you have to fill all of the surface area with five smaller white circles
it may seen easy, but it's harder than it ...
8
votes
7answers
376 views
Heaviest increasing subsequence
A subsequence is a sequence that can be derived from another sequence by deleting some elements without changing the order of the remaining elements. A strictly increasing subsequence is a subsequence ...
2
votes
0answers
183 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
174 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
101 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
457 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
103 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
214 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
708 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 ...
4
votes
6answers
3k 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 ...
5
votes
6answers
705 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
517 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. ...
5
votes
3answers
237 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
929 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
650 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 ...
5
votes
4answers
815 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 ...
11
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 ...