From: Ken Bloom Date: 2008-01-07T11:10:02+09:00 Subject: Re: zed shaw zed shaw zed shaw On Fri, 04 Jan 2008 17:58:15 -0500, Giles Bowkett wrote: >> > Tangent: city ITA Software has a really cool interview question: come >> > up with maximum number of combinations of movie titles, e.g., "The >> > Unbearable Lightness Of Being John Malkovich." >> >> Hat trick: Gone with the Winds of War and Peace. > > No, the whole point is to do it in Ruby. > >> Can this get any more off topic? > > OK, do it in Ruby, and then tell everybody you're going to kick their > ass. K=100 #set this to the number of movies you want in the invented title require 'open-uri' MOVIES=open('http://itafullsite.dev.neptuneweb.com/careers/puzzles/ MOVIES.LST'){|f| f.readlines} MOVIES.collect!{|x| x.split} class Array def shuffle! size.downto 1 do |n| push(delete_at(rand(n))) end self end end cstack=[MOVIES.dup.shuffle!] pstack=[cstack[-1].shift] while pstack.size