Problem 07
This commit is contained in:
1 parent
79fa83ef67
commit
78f56c809e
2 files changed
+26
No files matched your search
@@ -0,0 +1,12 @@
|
||||
package ninetyNineScalaProblems
|
||||
|
||||
import scala.annotation.tailrec
|
||||
|
||||
object Problem07:
|
||||
def flattenNestedList(list: List[Any]): List[Any] =
|
||||
def loop(l: List[Any]): List[Any] =
|
||||
l.flatMap:
|
||||
case ls: List[Any] => loop(ls)
|
||||
case e => List(e)
|
||||
|
||||
loop(list)
|
||||
Reference in new issue
Block a user