Skip to content

Instantly share code, notes, and snippets.

@fredrik
Created May 28, 2009 08:00
Show Gist options
  • Save fredrik/119176 to your computer and use it in GitHub Desktop.
Save fredrik/119176 to your computer and use it in GitHub Desktop.
# what's the single state in america whose name does not
# have any letters in common with george w. bush?
states='Alabama
Alaska
Arizona
Arkansas
California
Colorado
Connecticut
Delaware
Florida
Georgia
Hawaii
Idaho
Illinois
Indiana
Iowa
Kansas
Kentucky
Louisiana
Maine
Maryland
Massachusetts
Michigan
Minnesota
Mississippi
Missouri
Montana
Nebraska
Nevada
New Hampshire
New Jersey
New Mexico
New York
North Carolina
North Dakota
Ohio
Oklahoma
Oregon
Pennsylvania
Rhode Island
South Carolina
South Dakota
Tennessee
Texas
Utah
Vermont
Virginia
Washington
West Virginia
Wisconsin
Wyoming'.split("\n")
name='georgewbush'.split('').uniq
def name_in_state(name, state)
return (state - name) == state
end
for state in states
if name_in_state(name, state.downcase.split(''))
puts "well, it's #{state}"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment