Skip to content

Instantly share code, notes, and snippets.

View Ellzord's full-sized avatar

Elliot Ford Ellzord

View GitHub Profile
@wolfendale
wolfendale / maxsublist.scala
Created October 4, 2018 19:42
Maximum Sublist
import scala.util.Random
implicit class SubsetList[A](list: List[A]) {
def sublists: Stream[List[A]] = for {
length <- (0 to list.length).toStream
combination <- list combinations length
} yield combination
}
def maxSublistBounded(list: List[Int], boundary: Int): (List[Int], Int) = {