Skip to content

Instantly share code, notes, and snippets.

@bmaland
Created September 22, 2008 17:55
Show Gist options
  • Save bmaland/12070 to your computer and use it in GitHub Desktop.
Save bmaland/12070 to your computer and use it in GitHub Desktop.
def consistent?(phone_numbers)
phone_numbers.each do |num|
phone_numbers - [ num ].each { |o| return "NO" if %r{^#{num}}.match(o) }
end
"YES"
end
gets.to_i.times do
num_array = []
gets.to_i.times { num_array << gets.chomp }
puts consistent? num_array
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment