Complete the code to initialize the dictionary for storing seen numbers.
seen = [1]We use an empty dictionary {} to store numbers and their indices for quick lookup.
Complete the code to iterate over the list with index and value.
for [1], num in enumerate(nums):
The variable i is commonly used as the index in loops.
Fix the error in checking if the complement exists in the dictionary.
if [1] in seen:
num is in seen instead of the complement.i instead of the complement.We check if the complement target - num is already in the dictionary seen.
Fill both blanks to return the indices of the two numbers that add up to target.
return [seen[[1]], [2]]
Return the index of the complement from seen and the current index i.
Fill all three blanks to add the current number and its index to the dictionary.
seen[[1]] = [2] # After loop ends return [3]
Add the current number as key and index as value to seen. Return None if no pair found.
