Skip to content

Instantly share code, notes, and snippets.

@dizzarg
Created March 24, 2018 05:34
Show Gist options
  • Save dizzarg/c5fcfa9885d821a153a0d5364f8522f5 to your computer and use it in GitHub Desktop.
Save dizzarg/c5fcfa9885d821a153a0d5364f8522f5 to your computer and use it in GitHub Desktop.
MurkyDisgustingModules created by dizzarg - https://repl.it/@dizzarg/MurkyDisgustingModules
import Data.List
minfree xs = minform 0 (length xs, xs)
minform a (n, xs) | n==0 = a
| m == b-a = minform b (n-m, vs)
| otherwise = minform a (m, us)
where (us,vs) = partition (<b) xs
b = a+1+n `div` 2
m=length us
main = putStrLn $ show (minfree([0,2,3,4]))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment