Your question is Find Pair Summing to Target. Start with the requirements on the right.
Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.
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):