Questions tagged [fastest-algorithm]

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

Filter by
Sorted by
Tagged with
1 vote
1 answer
120 views

Sequence avoiding near collision [closed]

Task Find a sequence of all numbers between min and max where every number differs from every other number in the sequence by at least "d" digits. Example of sub-sequence For min = 0, max = 1000 ...
Josh Bannon's user avatar
2 votes
0 answers
132 views

Quotient in base 31 numeral system [closed]

You're given two numbers a and b in base 31 numeral system and number k with no more than 10000 decimal digits. It is known that b is divisor of a. The task is to find last k 31-based-digits of ...
Igor's user avatar
  • 121
9 votes
7 answers
3k 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 ...
Kishan Kumar's user avatar
0 votes
2 answers
3k 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 ...
alienCoder's user avatar
2 votes
0 answers
284 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 ...
shane's user avatar
  • 121
-9 votes
1 answer
746 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 ...
flint's user avatar
  • 11
9 votes
8 answers
1k 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 ...
orlp's user avatar
  • 39.1k
2 votes
0 answers
238 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 ...
Sherpinsky's user avatar
9 votes
1 answer
257 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 ...
orlp's user avatar
  • 39.1k
8 votes
1 answer
217 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 ...
Joe Z.'s user avatar
  • 34.9k
12 votes
2 answers
3k 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,...
Lance's user avatar
  • 235
-3 votes
2 answers
1k 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' (...
ericmarkmartin's user avatar
9 votes
3 answers
2k 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 ...
user avatar
5 votes
6 answers
5k views

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

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 ...
CMCDragonkai's user avatar
6 votes
9 answers
7k views

Same word when missing letters [closed]

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 ...
F. Hauri  - Give Up GitHub's user avatar
5 votes
5 answers
888 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. ...
mmk's user avatar
  • 251
2 votes
1 answer
752 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. ...
padawan's user avatar
  • 314
5 votes
3 answers
276 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 ...
Mikaël Mayer's user avatar
6 votes
7 answers
6k 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 ...
Xinbi's user avatar
  • 79
15 votes
14 answers
33k views

Array Merge without Duplicates

I recently saw this Javascript code on StackOverflow for merging two arrays, and removing duplicates: ...
hkk's user avatar
  • 261
9 votes
8 answers
3k 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 ...
eggonlegs's user avatar
  • 191
-2 votes
2 answers
3k views

Conversion to palindrome with minimal points used

Input: a word (2-100 characters) Convert this word to a palindrome: delete character - 13 points add character - 12 points increase character - 5 points ('d' > 'e') decrease character - 4 points ('n'...
e-MEE's user avatar
  • 123
1 vote
4 answers
728 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 ...
Greyhound's user avatar
9 votes
6 answers
3k 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 ...
Quixotic's user avatar
  • 2,379
5 votes
4 answers
2k views

Fastest algorithm for decomposing a perfect power

A perfect power is a positive integer that's equal to one positive integer, to the power of another positive integer (e.g. ab is a perfect power). Note that trivial solutions (e.g. b=1) are excluded; ...
Quixotic's user avatar
  • 2,379
16 votes
5 answers
6k views

Count number of hefty decimals between 2 numbers [closed]

Let's say we have a non-negative integer that is "hefty" (that is, "heavy") if its average digit value is greater than 7. The number 6959 is "hefty" because: (6 + 9 + 5 + 9) / 4 = 7.5 The number ...
user avatar
14 votes
5 answers
11k views

Free a Binary Tree [closed]

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 ...
Martin York's user avatar

1
2