[ create a new paste ] login | about

Link: http://codepad.org/TgbMu3oq    [ raw code | output | fork ]

Haskell, pasted on Sep 25:
1
2
3
4
5
6
7
8
9
10
11
import Control.Monad
import Data.List

test = [3,2,6,4,5,1]

lsbs cs = filter ((==ml) . length) sortonly
    where sortonly = filter (\a -> sort a == a) (subs cs)
          ml = maximum $ map length sortonly
          subs cs = filterM (\a -> [True, False]) cs

main = print $ lsbs test


Output:
1
[[3,4,5],[2,4,5]]


Create a new paste based on this one


Comments: