Last answered:

28 May 2022

Posted on:

22 May 2021


Error in the dictionary key: pairing?

I believe there is an error in the dictionary created during this video showing the two sum solution.

The dictionary shown is :

d = {2:0, 5:1, 3:2, 7:3, 4:5}
I believe it should be

d = {2:0, 5:1, 3:2, 7:3, 4:4}

1 answers ( 0 marked as helpful)
Posted on:

28 May 2022


Hi Vishal,

I think you might be correct - there's no reason for the list indexes (which are given by the values in the dictionary) to skip a position.

Perhaps Giles was checking for attention to detail :), but more likely a minor error when writing out the dictionary by hand.

In any case, good pick.

Submit an answer