Two sum: Difference between revisions
m
→Haskell :: Returning all matches
(Added APL solution) |
|||
Line 872:
sumTo n ns =
let ixs = zip [0 ..] ns
in ixs
>>= ( \(i, x) ->
drop (
>>= \(j, y) ->
[ (i, j)
| (x + y) == n
]
)
main :: IO ()
|