solution to week 6 - part 1 (2sum)