Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- let rec getSubLists (len : int) (list : List<int>) : List<List<int>> =
- let result = new List<List<int>>()
- let current = new List<int>()
- let rec findSubLists (len : int) (superSet : List<int>) (current : List<int>) (soln : List<List<int>>) (idx : int) : unit =
- if current.Length = len then soln.Insert(len - 1, current)
- elif idx = superSet.Length then
- let x = superSet.[idx]
- current.Insert(len, x)
- findSubLists len superSet current soln (idx + 1)
- current.RemoveAt(x)
- findSubLists len superSet current soln (idx + 1)
- else ()
- findSubLists len list current result 0
- result
Add Comment
Please, Sign In to add comment