Given list containing items (integer, lists, sub-lists) implement recursive function which returns list with all values flattened. This function mimics behaviour of Kotlin build in ` flatten` method.
Challenge | Solution |
Don’t use Kotlin build in flatten function.
flatten(listOf(1)) // 1
flatten(listOf(1), listOf(listOf(2))) // 1, 2
flatten(listOf(1), listOf(listOf(2), listOf(listOf(3)))) // 1, 2, 3