Welcome to the Python screen.
The question is on your right: Find Pair Summing to Target. Read through the requirements first.
Run and submit your code as often as you need. You also have five interviewer messages this session - want to talk through your approach, or are you ready to start coding?
At Stripe, you are given an unsorted list of integers and a target value. Return the indices of the two distinct elements whose values add up to the target.
Implement a function that takes:
nums: a list of integerstarget: an integerReturn:
[i, j] where i != j and nums[i] + nums[j] == target[]You may assume indices can be returned in any order unless otherwise specified.
def two_sum(nums, target):