Skip to content

Instantly share code, notes, and snippets.

@tessro
Created October 29, 2009 00:02
Show Gist options
  • Save tessro/220996 to your computer and use it in GitHub Desktop.
Save tessro/220996 to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
# http://www.facebook.com/careers/puzzles.php?puzzle_id=7
# Memory-heavy but low-computation solution
LOOP = [nil, nil, "Hoppity", nil, "Hophop", "Hoppity", nil, nil, "Hoppity", "Hophop", nil, "Hoppity", nil, nil, "Hop"]
File.open(ARGV[0], 'r') do |f|
f.readline.to_i.times do |i|
puts LOOP[i] unless LOOP[i].nil?
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment