Guest User

Untitled

a guest
Oct 17th, 2017
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.61 KB | None | 0 0
  1. let rec getSubLists (len : int) (list : List<int>) : List<List<int>> =
  2. let result = new List<List<int>>()
  3. let current = new List<int>()
  4.  
  5. let rec findSubLists (len : int) (superSet : List<int>) (current : List<int>) (soln : List<List<int>>) (idx : int) : unit =
  6. if current.Length = len then soln.Insert(len - 1, current)
  7. elif idx = superSet.Length then
  8. let x = superSet.[idx]
  9. current.Insert(len, x)
  10. findSubLists len superSet current soln (idx + 1)
  11. current.RemoveAt(x)
  12. findSubLists len superSet current soln (idx + 1)
  13. else ()
  14.  
  15. findSubLists len list current result 0
  16. result
Add Comment
Please, Sign In to add comment