Program for two Sum
function twoSum ( nums ) { let map = new Map ( ) ; for ( let i = 0 ; i < nums . length - 1 ; i ++ ) { for ( let j = i + 1 ; j < nums . length ; j ++ ) { map . set ( nums [ i ] + nums [ j ] , new pair ( i , j ) ) ; } } return map ; }