0

Is there any way to take a lists of lists, with any depth level, and return the list completely flat (like in LISP)? For example:

input: [[[1]], [[[[2]]]], [3], 4, [[[[[[5],[6]]]]]]]
output: [1,2,3,4,5,6]

This is an extreme example, I'm using it just to illustrate my question.

smci
  • 29,564
  • 18
  • 109
  • 144
  • 4
    You'd likely use a recursive approach for this unless the depth of the lists could potentially exceed what the stack can hold. What have you tried to solve this already? – Carcigenicate Aug 09 '21 at 21:44

0 Answers0