2016 Update
This commit is contained in:
parent
948b86eafa
commit
dcf5d15da3
7965 changed files with 139854 additions and 31002 deletions
|
|
@ -2,9 +2,9 @@ defmodule Chinese do
|
|||
def remainder(mods, remainders) do
|
||||
max = Enum.reduce(mods, fn x,acc -> x*acc end)
|
||||
Enum.zip(mods, remainders)
|
||||
|> Enum.map(fn {m,r} -> Enum.take_every(r..max, m) |> Enum.into(HashSet.new) end)
|
||||
|> Enum.reduce(fn set,acc -> Set.intersection(set, acc) end)
|
||||
|> Set.to_list
|
||||
|> Enum.map(fn {m,r} -> Enum.take_every(r..max, m) |> MapSet.new end)
|
||||
|> Enum.reduce(fn set,acc -> MapSet.intersection(set, acc) end)
|
||||
|> MapSet.to_list
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue