Skip to content

wrecking-yard/ex_subset_sum

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 

Repository files navigation

ExSubsetSum

based on https://panduwana.wordpress.com/2010/04/21/combination-in-erlang/

Description

See here

Example

iex> ExSubsetSum.sum_of_one(Enum.to_list(1..10), 10)
[
  [10],
  [1, 9],
  [2, 8],
  [3, 7],
  [4, 6],
  [1, 2, 7],
  [1, 3, 6],
  [1, 4, 5],
  [2, 3, 5],
  [1, 2, 3, 4]
]

iex> ExSubsetSum.sum_of_all(Enum.to_list(1..10), [1, 4, 5])
[
  [10],
  [1, 9],
  [2, 8],
  [3, 7],
  [4, 6],
  [1, 2, 7],
  [1, 3, 6],
  [1, 4, 5],
  [2, 3, 5],
  [1, 2, 3, 4]
]

About

No description or website provided.

Topics

Resources

Stars

Watchers

Forks

Languages