The Complement Hunt
A easy Python interview practice problem on DataDriven. Write and execute real python code with instant grading.
- Domain
- Python
- Difficulty
- easy
- Seniority
- L4
Problem
Given a list of integers and a target integer, return a 2-element list [i, j] with i < j such that nums[i] + nums[j] = target. Exactly one solution exists.
Summary
Every number is looking for its other half.
Practice This Problem
Solve this Python problem with real code execution. DataDriven runs your Python code in a real environment and grades it automatically.