Last active
February 8, 2023 03:00
-
-
Save mgritter/68bdcbbbd5b607764fceba9085ae6e60 to your computer and use it in GitHub Desktop.
Which states have a word that uniquely identifies them? All other states have a letter shared with this word.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ALABAMA -- cover DHNOS optionally CEFGIJKPQRTUVWXYZ | |
ALASKA -- cover EHMNO optionally BCDFGIJPQRTUVWXYZ | |
ARIZONA -- cover DEGHLMSW optionally BCFJKPQTUVXY | |
CALIFORNIA -- cover DEGHMSWZ optionally BJKPQTUVXY | |
COLORADO -- cover BEHIKN optionally FGJMPQSTUVWXYZ | |
CONNECTICUT -- cover AGHKMS optionally BDFJLPQRVWXYZ | |
DELAWARE -- cover BHNOS optionally CFGIJKMPQTUVXYZ | |
FLORIDA -- cover BCEHNSW optionally GJKMPQTUVXYZ | |
GEORGIA -- cover HLNSW optionally BCDFJKMPQTUVXYZ | |
HAWAII -- cover LNOST optionally BCDEFGJKMPQRUVXYZ | |
ILLINOIS -- cover ACEHM optionally BDFGJKPQRTUVWXYZ | |
INDIANA -- cover EGHKMO optionally BCFJLPQRSTUVWXYZ | |
IOWA -- cover EHLNS optionally BCDFGJKMPQRTUVXYZ | |
KANSAS -- cover EILRT optionally BCDFGHJMOPQUVWXYZ | |
KENTUCKY -- cover AOS optionally BDFGHIJLMPQRVWXZ | |
MAINE -- cover BCDGHOS optionally FJKLPQRTUVWXYZ | |
MARYLAND -- cover BEHIKO optionally CFGJPQSTUVWXZ | |
MICHIGAN -- cover BDEORSTW optionally FJKLPQUVXYZ | |
MISSISSIPPI -- cover ANO optionally BCDEFGHJKLQRTUVWXYZ | |
MISSOURI -- cover AHNP optionally BCDEFGJKLQTVWXYZ | |
MONTANA -- cover EHIKL optionally BCDFGJPQRSUVWXYZ | |
NEVADA -- cover BIKRT optionally CFGHJLMOPQSUWXYZ | |
NEW JERSEY -- cover AIOT optionally BCDFGHKLMPQUVXZ | |
NEW MEXICO -- cover AGHRST optionally BDFJKLPQUVYZ | |
NEW YORK -- cover AGIJT optionally BCDFHLMPQSUVXZ | |
NORTH DAKOTA -- cover EILMSU optionally BCFGJPQVWXYZ | |
OHIO -- cover AMN optionally BCDEFGJKLPQRSTUVWXYZ | |
OKLAHOMA -- cover BDINST optionally CEFGJPQRUVWXYZ | |
OREGON -- cover AITW optionally BCDFHJKLMPQSUVXYZ | |
PENNSYLVANIA -- cover DHKMORT optionally BCFGJQUWXZ | |
TENNESSEE -- cover AIOY optionally BCDFGHJKLMPQRUVWXZ | |
TEXAS -- cover HILNO optionally BCDFGJKMPQRUVWYZ | |
UTAH -- cover ILNOS optionally BCDEFGJKMPQRVWXYZ | |
VERMONT -- cover AGISY optionally BCDFHJKLPQUWXZ | |
VIRGINIA -- cover DEHKMO optionally BCFJLPQSTUWXYZ | |
WISCONSIN -- cover AEHLM optionally BDFGJKPQRTUVXYZ | |
WYOMING -- cover AEHS optionally BCDFJKLPQRTUVXZ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Alabama -- UNSHOD, FISHPOND | |
Alaska -- PHENOM, MORPHINE, DEMIJOHN | |
Colorado -- BETHINK (unique) | |
Delaware -- BOHUNKS | |
Hawaii -- STOLEN, TEFLONS. LEPTONS, LOCKNUTS | |
Illinois -- MACHER, REMATCH, CHARMED, CHAMBER, PACHYDERM | |
Iowa -- UNHELMS, LUNCHES, LENGTHS, LYNCHERS | |
Kansas -- FLUORITE, DEVILTRY, BLIGHTER | |
Kentucky -- SOAP, SOBA, OPALS, ORGASM | |
Maryland -- KIBOSHES | |
Michigan -- BESTROWED | |
Mississippi -- NOVA, LOAN, WAGON | |
Missouri -- PHANG, PEAHEN, HAPPEN, PANACHE | |
Montana -- HULKIER, WHIPLIKE, FISHLIKE, CLERKSHIP, HUCKLEBERRIES | |
Nevada -- BRISKET | |
New Jersey -- PATIO, BIOTA, UTOPIA, OXTAIL | |
New Mexico -- DRAUGHTS, HATGUARDS | |
New York -- JUDGMATIC | |
North Dakota -- SUBLIME, MUESLIS, IMPULSE | |
Ohio -- MAN, NAME, DAMN, RAMEN, and of course MACKEREL | |
Oklahoma -- DUSTBIN, BENEDICTS, SUBDUCTING, UNDISTURBED | |
Oregon -- WAIT, WILDCAT, LAWSUIT | |
Tennessee -- OILWAY, MYOPIA, DAIMYO, OLYMPIAD | |
Texas -- HOLING, PHONILY, HOWLING, DOWNHILL | |
Utah -- LIONS, NOSILY, LOSING, VIOLINS | |
Vermont -- GASIFY, HIGHWAYS | |
Virginia -- SMOKEHOOD, HUMMOCKED | |
Wisconsin -- HAMLET, THERMAL, PAMPHLET, HEADLAMP | |
Wyoming -- SHEAR, SHADE, CHEERLEADERS | |
Arizona -- no words containing DEGHLMSW except MIDDLEWEIGHTS | |
California -- no words containing DEGHMSWZ | |
Connecticut -- no words containing AGHKMS that do not have i, e, or n | |
Florida -- no words with BCEHNSW but not a, i, or o | |
Georgia -- no words with HLNSW but not a, e, i, or o | |
Indiana -- no words with EGHKMO but not a or i (but MOTHERFUCKING deserves an honorable mention) | |
Maine -- no words with BCDGHOS but not e (honorable mention DOUCHEBAGS) | |
Pennsylvania -- no words with DHKMORT but not i (DURCHKOMPONIRT) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"] | |
def no_letters_with( word ): | |
return [s for s in states if not (set(s) & set(word))] | |
def greedy_set_cover( universe, tagged_sets ): | |
if len( universe ) == 0: | |
return [] | |
best_tag = None | |
best_set = None | |
best_u = None | |
for (t,s) in tagged_sets: | |
uncovered = len( universe.intersection( s ) ) | |
if best_u is None or uncovered > best_u: | |
best_tag = t | |
best_set = s | |
best_u = uncovered | |
if best_u is None: | |
return [ "UNCOVERED" ] | |
return [best_tag] + greedy_set_cover( | |
universe.difference( best_set ), | |
[(t,s) for (t,s) in tagged_sets if t != best_tag ] ) | |
alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" | |
def cover_other_states( s ): | |
universe = set( x for x in states if x != s ) | |
tagged_sets = [ (a, set( x for x in states if a in x )) | |
for a in alphabet | |
if a not in s ] | |
return greedy_set_cover( universe, tagged_sets ) | |
for s in states: | |
cover = cover_other_states( s ) | |
if not "UNCOVERED" in cover: | |
print( s, "-- cover", "".join( sorted( cover) ), | |
"optionally", | |
"".join( sorted( set(alphabet).difference( s ).difference( cover ) ) ) ) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment