The algorithm tag has no wiki summary.
-5
votes
1answer
122 views
Sort an array with values of integer
There is an array of integer values to be sorted.During the sorting process, the places of two numbers can be interchanged. Each interchange has a cost, which is the sum of the two numbers involved.
...
8
votes
1answer
257 views
Best Scoring Boggle Board
I hope nobody has an objection to me hijacking this question; I was interested in the results, but the question was never corrected/improved.
Given a set of 6-sided Boggle dice (stolen from this ...
0
votes
2answers
283 views
Water-Bucket problem
How to measure 4 liters of water with just two uneven shaped buckets, one of 3 liter another of 5 liter, in minimum number of steps. To extend and generalize this, write a program to evaluate the ...
0
votes
0answers
91 views
How to check for balanced parentheses with mod? [closed]
Using a single double and different int's for various types of parentheses, without stack how to check for balanced parentheses with mod?
-1
votes
1answer
117 views
Which is the most efficient prime algorithm? [closed]
Which is the most efficent and easy to understand prime algorithm in c++?
2
votes
14answers
433 views
determine longest group of consecutive numbers
INPUT:
10 random numbers
each number is greater than 0 and less than 100
list of numbers is presorted, lowest to highest
the list will not contain any duplicate numbers
the solution should be in ...
15
votes
4answers
497 views
Optimal short-hand roman numeral generator
Goal:
Write a function that takes a number as input and returns a short-hand roman numeral for that number as output.
Roman Numeral Symbols:
Symbol Value
I 1
V 5
X 10
L 50
...
10
votes
1answer
476 views
I used to solve code golf puzzles like you, but then I took an arrow in the knee
Getting hit in the knee with arrows seems to be the injury of choice right now. As such, I propose the following golf challenge.
You have an adventurer that looks like this:
O
/|\
/ | \
|
|
...
-7
votes
5answers
181 views
write a code the find n-th number of Gray Code list
Write a function that, given N >= 0, finds the Nth number in a standard Gray code.
Example input:
1
2
3
4
Example output:
1
3
2
6
Additional reference
1
vote
5answers
237 views
position of the only 1 in a number in binary format
Given N is a number from this list : 1, 2, 4, 8, 16, .... 2^i
as you know there is only a single "1" in binary representation of above numbers.
Question : write a code to find out the position of ...
23
votes
0answers
581 views
Help Indiana Jones to get the treasure
Story
Indiana Jones was exploring a cave where a precious treasure is located. Suddenly, an earthquake was happen.
When the earthquake was ended, he noticed that some rocks fell from the ceiling ...
5
votes
2answers
240 views
Unfolding an integer
Given the functions
L: (x, y) => (2x - y, y)
R: (x, y) => (x, 2y - x)
and a number N generate a minimal sequence of function applications which take the initial pair (0, 1) to a pair which ...
2
votes
1answer
481 views
Determining the winner of a Chess game
Challenge
Being someone who plays far too much chess in his spare time, I thought I'd set a code golf challenge inspired by the game of chess (with a software flavour), for those interested.
The ...
4
votes
1answer
302 views
Optimize matrix chain multiplication
This challenge is to compute the most efficient multiplication order for a product of several matrices.
The size of the matrices is specified on a single line of standard input. You should print to ...
1
vote
0answers
115 views
Minimize the number of coins for a purchase [closed]
We have a set of 5 coin denominations: penny, nickel, dime, quarter, and half-dollar. The number of coins for a purchase is the number of coins given from the buyer to the seller, plus the number ...