September 2017 Update
This commit is contained in:
parent
bba7bfd280
commit
ba8067c3b7
14570 changed files with 153136 additions and 63871 deletions
|
|
@ -0,0 +1,37 @@
|
|||
import Data.List ((\\), permutations, nub)
|
||||
import Control.Monad (join)
|
||||
|
||||
missingPerm
|
||||
:: Eq a
|
||||
=> [[a]] -> [[a]]
|
||||
missingPerm = (\\) =<< permutations . nub . join
|
||||
|
||||
deficientPermsList :: [String]
|
||||
deficientPermsList =
|
||||
[ "ABCD"
|
||||
, "CABD"
|
||||
, "ACDB"
|
||||
, "DACB"
|
||||
, "BCDA"
|
||||
, "ACBD"
|
||||
, "ADCB"
|
||||
, "CDAB"
|
||||
, "DABC"
|
||||
, "BCAD"
|
||||
, "CADB"
|
||||
, "CDBA"
|
||||
, "CBAD"
|
||||
, "ABDC"
|
||||
, "ADBC"
|
||||
, "BDCA"
|
||||
, "DCBA"
|
||||
, "BACD"
|
||||
, "BADC"
|
||||
, "BDAC"
|
||||
, "CBDA"
|
||||
, "DBCA"
|
||||
, "DCAB"
|
||||
]
|
||||
|
||||
main :: IO ()
|
||||
main = print $ missingPerm deficientPermsList
|
||||
|
|
@ -0,0 +1,37 @@
|
|||
import Data.List (minimumBy, group, sort, transpose)
|
||||
import Data.Ord (comparing)
|
||||
|
||||
missingPerm
|
||||
:: Ord a
|
||||
=> [[a]] -> [a]
|
||||
missingPerm = ((head . minimumBy (comparing length) . group . sort) <$>) . transpose
|
||||
|
||||
deficientPermsList :: [String]
|
||||
deficientPermsList =
|
||||
[ "ABCD"
|
||||
, "CABD"
|
||||
, "ACDB"
|
||||
, "DACB"
|
||||
, "BCDA"
|
||||
, "ACBD"
|
||||
, "ADCB"
|
||||
, "CDAB"
|
||||
, "DABC"
|
||||
, "BCAD"
|
||||
, "CADB"
|
||||
, "CDBA"
|
||||
, "CBAD"
|
||||
, "ABDC"
|
||||
, "ADBC"
|
||||
, "BDCA"
|
||||
, "DCBA"
|
||||
, "BACD"
|
||||
, "BADC"
|
||||
, "BDAC"
|
||||
, "CBDA"
|
||||
, "DBCA"
|
||||
, "DCAB"
|
||||
]
|
||||
|
||||
main :: IO ()
|
||||
main = print $ missingPerm deficientPermsList
|
||||
|
|
@ -1,16 +0,0 @@
|
|||
import Data.List
|
||||
import Control.Monad
|
||||
import Control.Arrow
|
||||
|
||||
missingPerm :: Eq a => [[a]] -> [[a]]
|
||||
missingPerm = (\\) =<< permutations . nub . join
|
||||
|
||||
deficientPermsList = ["ABCD","CABD","ACDB","DACB",
|
||||
"BCDA","ACBD","ADCB","CDAB",
|
||||
"DABC","BCAD","CADB","CDBA",
|
||||
"CBAD","ABDC","ADBC","BDCA",
|
||||
"DCBA","BACD","BADC","BDAC",
|
||||
"CBDA","DBCA","DCAB"]
|
||||
|
||||
main = do
|
||||
print $ missingPerm deficientPermsList
|
||||
Loading…
Add table
Add a link
Reference in a new issue