object Main extends App { def f(a:Seq[Int])=a.indices.flatMap(a.combinations).filter(_.sum==10) val array = List(1, 2, 3, 4, 5, 6, 7, 8, 9, 10) println(f(array))}
Standard input is empty
Vector(List(10), List(1, 9), List(2, 8), List(3, 7), List(4, 6), List(1, 2, 7), List(1, 3, 6), List(1, 4, 5), List(2, 3, 5), List(1, 2, 3, 4))
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!