Skip to content

Instantly share code, notes, and snippets.

@chaoxu
Created June 27, 2011 07:21
Show Gist options
  • Save chaoxu/1048440 to your computer and use it in GitHub Desktop.
Save chaoxu/1048440 to your computer and use it in GitHub Desktop.
testing some data
import Data.List
binaryArray n = a [] n
a list 0 = [list]
a list n = (a (0:list) (n-1))++(a (1:list) (n-1))
f list = map (fx list) [1..length list]
fx list j = 1 + (length (takeWhile ((/=) (maximum result)) result))
where result = map (sum . (take j) . (flip drop list)) [0..(length list)-j]
g n = length (map head ((group . sort) (map f (binaryArray n))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment