Two sum: Difference between revisions
Content deleted Content added
m →ES6 |
m →ES6: Minor simplification |
||
Line 244:
// summingPairIndices :: -> Int -> [Int] -> [(Int, Int)]
let summingPairIndices = (n, xs) =>
concatMap((x, ix) => concatMap((y, iy) =>
x + y === n ? [
[iy, ix]
] : []
), xs), xs);
return summingPairIndices(21, [0, 2, 11, 19, 90]);
|