Find two numbers that sum to target
Company: Amazon
Role: Machine Learning Engineer
Category: Coding & Algorithms
Difficulty: medium
Interview Round: Technical Screen
Quick Answer: This question evaluates a candidate's competency in basic algorithmic problem-solving within the Coding & Algorithms domain, focusing on array manipulation, pair-sum reasoning, and analysis of time-space trade-offs.
Constraints
- Inputs are Python literals matching the function signature.
- Return a deterministic exact-match value.
Examples
Input: ([2,7,11,15], 9)
Expected Output: [0, 1]
Explanation: 2 + 7 matches the target.
Input: ([3,3], 6)
Expected Output: [0, 1]
Explanation: Distinct indices can hold equal values.
Input: ([0,4,3,0], 0)
Expected Output: [0, 3]
Explanation: The same value can be used from two different indices.
Hints
- Clarify edge cases before coding.
- Keep outputs deterministic when several valid answers exist.