Skip to content

Instantly share code, notes, and snippets.

@stevenkaras
stevenkaras / disjoint-words.py
Last active August 7, 2022 20:51
Wordle DIsjoint Set
# /usr/bin/env python
# The point of this exercise is to find a list of 5 words with 25 unique letters across them.
# As suggested by https://www.youtube.com/watch?v=_-AfhLQfb6w
#
# This problem is equivalent to searching for a disjoint set in the graph induced on shared letters between words.
# That problem is equivalent to searching for a clique in the inverse graph.
# The approach used here builds the graph as edges first between letters, then between words.
# Each step increases the cliques it found by 1 word.
#