June 15th, 2011 0 comments

This week I am shifting to programs which require some programming to solve.

Given a string, return the largest palindrome substring. A palindrome is a string which is identical when reversed (E.G. a, aa, aba, abcba).

When you have your solution, run it on the following string:

I originally found this problem at programmingpraxis.com

June 6th, 2011 1 comment

Given a rectangular cake with a rectangular piece removed (any size or orientation), how would you cut the remainder of the cake into two equal halves with one straight cut of a knife?

May 23rd, 2011 0 comments

Three gods A, B, and C are called, in no particular order, True, False, and Random. True always speaks truly, False always speaks falsely, but whether Random speaks truly or falsely is a completely random matter. Your task is to determine the identities of A, B, and C by asking three yes-no questions; each question must be put to exactly one god. The gods understand English, but will answer all questions in their own language, in which the words for yes and no are da and ja, in some order. You do not know which word means which.

May 16th, 2011 0 comments

A great king's guards have caught an assassin leaving the wine cellar with an empty poison vial.

In the cellar there are 1000 bottles of wine and there was only enough poison for one of them. In 24 hours the king is throwing a banquet and will need to serve his wine. A single sip of the poison is deadly in 15 to 20 hours, with no symptoms showing until death.

What is the minimum number of people who have to risk their lives (voluntarily, of course) to determine exactly which bottle is poisoned?

What if there are an arbitrary number of bottles?

May 9th, 2011 5 comments

Love in Kleptonia:

Jan and Maria have fallen in love over the internet and Jan wishes to mail Maria a ring. Unfortunately, they live in the country of Kleptopia where anything sent through the mail will be stolen unless it is sent by padlocked box. Jan and Maria both have plenty of padlocks, but none to which the other has a key.

How can Jan get the ring safely into Maria's hands?