4 ms·
Nice and short Haskell solution to #3: http://gist.github.com/617675 http://gist.github.com/617675 Ruby solutions to #1 and #2: http://gist.github.com/617676 h
by gmaster1440 16y ago
Nice and short Haskell solution to #3: http://gist.github.com/617675 http://gist.github.com/617675
Ruby solutions to #1 and #2:
http://gist.github.com/617676 http://gist.github.com/617676
http://gist.github.com/617678 http://gist.github.com/617678
- thomie 16y agoNice, but don't compute the length of a list if you don't have to. (not . null) instead of (\x -> length x > 1) is shorter, and works on infinite lists also. Edit: well, in case you would test for x>0.