Problem 07

This commit is contained in:
2026-03-19 15:39:19 +01:00
parent 79fa83ef67
commit 78f56c809e
2 changed files with 26 additions and 0 deletions
@@ -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)