Alex Fenton
12/7/2007 9:43:00 PM
Phrogz wrote:
> On Dec 7, 1:45 pm, Ruby Quiz <ja...@grayproductions.net> wrote:
>> Given a single word as input try to find a repeated letter inside of it such
>> that you can loop the text around and reuse that letter. For example:
>>
>> $ ruby word_loop.rb Mississippi
>> i
>> p
>> p
>> Mis
>> ss
>> si
<snip>
> Maybe it's because it's a Friday afternoon, but I don't understand the
> quiz problem. Could someone who understands this try explaining it
> (without, of course, discussing any code or even pseudo-code to
> approach it).
It took me a few monents too. The letters have to be arranged in a grid
so that by moving one square at a time, the word is spelled out. The
test is to see whether the word can be spelled out by, at some point,
moving over the same grid square twice.
I'm taking from the MISSISSIPI example that moves have to be in the same
direction as the last move, or at a 90 degree angle to it, otherwise
it could be spelled by moving up back onto "S" after the second "I" in
the bottom right.
a