Skip to main content
1 of 3
Jonathan Allan
  • 110.1k
  • 7
  • 65
  • 282

Jelly, 7 bytes

¬ß€;LFṀ

Try it online!

A monadic Link accepting a list containing any strictly positive integers or nested, similar, lists that yields the maximal length list.

How?

¬ß€;LFṀ - Link, call this "f": list, A
¬       - logical NOT (vectorises) - convert all positive integers to zeros so that
                                     we wont implicitly treat them as ranges
  €     - for each element, E:
 ß      -   call this Link (i.e. f(A=E))
    L   - length of A
   ;    - concatenate
     F  - flatten
      Ṁ - maximum
Jonathan Allan
  • 110.1k
  • 7
  • 65
  • 282