Only just heard of this, have some catching up to do! Here's my day 1 - similar to a couple of others already posted. Weirdly the part 1 problem came up in an interview just a couple of weeks ago!

defpart_one(nums,target):seen=set()possible=Falsefornuminnums:required=target-numifrequiredinseen:possible=Truebreakseen.add(num)ifpossible:returnnum,requiredreturn-1defpart_two(nums,target):seen=set()possible=Falsefornuminnums:fornum_2innums:req_num=target-num-num_2ifreq_numinseen:possible=Truebreakseen.add(num_2)else:continuebreakifpossible:returnnum,num_2,req_numreturn-1withopen("input.txt")asinput:nums=[int(line)forlineininput]res=part_one(nums,2020)ifres!=-1:x,y=resprint(f"Part 1 numbers are {x}, {y}, product is {x*y}")else:print(f"Part 1 cannot be solved from this dataset")res_2=part_two(nums,2020)ifres_2!=-1:x,y,z=res_2print(f"Part 2 numbers are {x}, {y}, {z} product is {x*y*z}")else:print(f"Part 2 cannot be solved from this dataset")

We're a place where coders share, stay up-to-date and grow their careers.

Only just heard of this, have some catching up to do! Here's my day 1 - similar to a couple of others already posted. Weirdly the part 1 problem came up in an interview just a couple of weeks ago!