/**
* @param {number[]} nums
* @param {number} target
* @return {number[]}
*/
var twoSum = function (nums ,target ) {
const numsToFind = {};
for (let i = 0; i<nums.length; i++ ) {
const numToFind = nums [i ];
if (numsToFind [numToFind ] >= 0 ) {
return [i ,numsToFind [numToFind ]];
}
numsToFind [target - numToFind ] = i ;
}
};
My solution for Two Sum problem in PHP.