On Dec 7, 3:45 pm, Phrogz <phr... / mac.com> wrote:
> On Dec 7, 2:27 pm, Phrogz <phr... / mac.com> 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
>
> > > or:
>
> > >         $ ruby word_loop.rb Markham
> > >         Ma
> > >         ar
> > >         hk
>
> > > or:
>
> > >         $ ruby word_loop.rb yummy
> > >         yu
> > >         mm
>
> > 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).
>
> > I've looked over those examples a few times and I'm totally baffled.
> > What does "loop the text around and reuse that letter" mean?
>
> Ah, got it.
>
> [y] -> [u]
>  ^      |
>  |      v
> [m] <- [m]
>
> [M] -> [a]
>  ^      |
>  |      v
> [a]    [r]
>  ^      |
>  |      v
> [h] <- [k]
>
>        [i]
>         ^
>         |
>        [p]
>         ^
>         |
>        [p]
>         ^
>         |
> [M] -> [i] -> [s]
>         ^      |
>         |      v
>        [s]    [s]
>         ^      |
>         |      v
>        [s] <- [i]

Very nice visual explanation.

I stared at this quiz for a while and simply could not understand. It
was only when I was about to post a reply begging for an explanation
that I got it.

It's clear to me now I should've posted a reply with the explanation
instead of just moving on.

--
-yossef