for challenges requiring the answers to be in a certain time complexity, or having a winning criterion about the time complexity.
12
votes
4answers
784 views
Find the maximum of ax+b
You are given a list of (a,b), and a list of x. Compute the maximum ax+b for each x. You can assume a, b and x are non-negative integers.
Your program or function must run in expected (to the ...
11
votes
14answers
2k views
Pick the longest stick
You are a young programming geek living with your 2 other best friends. Every week, one of you has to do all the chores of the house and you decide whose turn it is by picking a stick. The one who ...
7
votes
1answer
456 views
Approximate square root from algorithm time complexity
There have been a few square root challenges lately, but I think this one is different.
Challenge
Find an algorithm such that the worst case time complexity is proportional to n^2 and the best case ...
2
votes
5answers
444 views
Find X in a partially sorted Array
Your job is to find the location (read index) of a given element X in an array gone through the following transformation process:
Take a fully sorted integer array of size N (N is known implicitly)
...
0
votes
1answer
427 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 ...