Question DSA-HASH-0041
MediumWhat is the output of this code?
nums, target = [2, 7, 11, 15], 18
seen = {}
for i, x in enumerate(nums):
if target - x in seen:
print(seen[target - x], i)
break
seen[x] = i
- A.
2 1
- B.
0 3
- C.
Sign up free to see the answer and a step-by-step explanation.