// Given an array of integers, return indices of the two numbers such that they add up to a specific target.

// You may assume that each input would have exactly one solution.

// Example:
// Given nums = [2, 7, 11, 15], target = 9,

// Because nums[0] + nums[1] = 2 + 7 = 9,
// return [0, 1].



// set variable numLength as the nums array's length
// if numsLength is less than 2, return nums array
// create an object/hash called map to store each item in the array as the key and index as value
// create a for loop that runs as many times as the size of the array
  // if the target minus the current number is a hash key
  // or if the target minus the current number is equal to zero
    // return the key's value and the index in an array
  // if the current number is a key of the map is undefined
    // create a map key as they current number and value as the index


var twoSum = function(nums, target) { //96ms runtime
    var numLength = nums.length;
    if( numLength<2 ){
        return nums;
    }
    var map = {};
    for(var i = 0; i < numLength; i++){
         if( map[target - nums[i]] || map[target-nums[i]] === 0 ){
            return [map [ target-nums[i] ], i];
        }
        if( map[nums[i]] === undefined ){
            map[ nums[i] ] = i;
        }
    }
};

@@ -410,21 +410,14 @@
 te a
-n object/hash
+ cache
  cal
@@ -609,13 +609,8 @@
 s a 
-hash 
 key%0A
@@ -801,31 +801,16 @@
 // c
-reate a map key as
+ache
  the
-y
  cur
@@ -953,25 +953,16 @@
 ngth%3C2 )
-%7B%0A       
  return 
@@ -967,22 +967,16 @@
 n nums;%0A
-    %7D%0A
     var 
@@ -997,23 +997,20 @@
 for(
+ 
 var i
- = 
+=
 0; i
- %3C 
+%3C
 numL
@@ -1019,20 +1019,20 @@
 gth; i++
+ 
 )%7B%0A
- 
         
@@ -1043,24 +1043,24 @@
 map%5B
+ 
 target
- - 
+-
 nums%5Bi%5D
+ 
 %5D %7C%7C
@@ -1064,16 +1064,17 @@
  %7C%7C map%5B
+ 
 target-n
@@ -1075,24 +1075,25 @@
 rget-nums%5Bi%5D
+ 
 %5D === 0 )%7B%0A 
@@ -1089,29 +1089,16 @@
  === 0 )
-%7B%0A           
  return 
@@ -1126,26 +1126,16 @@
  %5D, i%5D;%0A
-        %7D%0A
         
@@ -1142,23 +1142,25 @@
 if( map%5B
+ 
 nums%5Bi%5D
+ 
 %5D === un
@@ -1172,21 +1172,8 @@
 ed )
-%7B%0A           
  map
@@ -1193,18 +1193,8 @@
  i;%0A
-        %7D%0A
     

edit solution