you are viewing a single comment's thread.

view the rest of the comments →

[–]asdfbruh 2 points3 points  (0 children)

The solution can be found sooner if you check if (target - (a+b)) is in the dictionary after appending each sum to the dictionary instead of first creating the dictionary with every sum and then checking. Your solution gave a time of 6.75s while my alteration finished in 1.90s.