Created
January 5, 2019 06:59
-
-
Save zahash/a3e87dfd8d408ca4832d7dac52135e63 to your computer and use it in GitHub Desktop.
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
def eliminate(grid_dict): | |
for k,v in grid_dict.items(): | |
if len(v) != 1: # if the box needs elimination | |
peers = peer_dict[k] # get all the peers | |
peer_values = set([grid_dict[p] for p in peers if len(grid_dict[p]) == 1]) | |
grid_dict[k] = ''.join(set(grid_dict[k]) - peer_values) | |
return grid_dict |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment