Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def part_two_fancy(ids):
- seen = set()
- for id in ids:
- #iteratively blank out each character in the id. Ex. "123" becomes "_23" and "1_3" and "12_"
- for i in range(len(id)):
- blanked_id = "".join("_" if idx==i else c for idx,c in enumerate(id))
- if blanked_id in seen:
- return blanked_id.replace("_", "")
- seen.add(blanked_id)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement