I've been trying to add duplicate keys to my python dictionary (table) in order to solve the "two Sum" problem.
Given an array of integers, return indices of the two numbers such that they add up to a specific target.
I've now realized this is impossible to do and would appreciate any ideas or suggestions on how to go about solving this problem without brute force. Please keep in mind i started trying to learn Python this week. So i apologize of theres a simple solution
numbers = [0, 0, 0, 0, 0, 0, 0] # initial list
target = 6 # The sum of two numbers within list
# Make list into dictionary where the given values are used as keys and
actual values are indices
table = {valueKey: index for index, valueKey in enumerate(numbers)}
print(table)
>>> {0: 6}