Created
June 13, 2012 23:17
-
-
Save bltavares/2927102 to your computer and use it in GitHub Desktop.
wcc 12.24
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Data.List | |
longestSubset xs = last $ sortBy summing $ subsets xs | |
where subsets = concatMap inits . tails | |
summing x y = sum x `compare` sum y | |
main = do | |
let arry = [(-2), 1, (-3), 4, (-1), 2, 1, (-5), 4] | |
print $ longestSubset arry |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment