Log in
← All problems

Two sum

mediumLists20 XP

Exactly one pair of numbers in nums adds up to target. Return their positions [i, j] with i < j. Can you do it in one pass with a dictionary?

Examples

Examples use JSON: true/false/null are True/False/None in Python.

Run examples checks the examples above. Submit also runs 3 hidden tests.