Skip to main content
added 1 character in body
Source Link
Jonathan Allan
  • 110.1k
  • 7
  • 65
  • 282

Jelly,  7  6 bytes

¬ß€»LṀ

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?

¬ß€»LṀ - 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, in A (...if the current A isn't now a zero):
 ß     -   call this Link (i.e. f(A=E))
    L  - length of A - Note that zero has length one.
   »   - maximum (vectorises)
     Ṁ - maximum (of the resulting list)

Jelly,  7  6 bytes

¬ß€»LṀ

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?

¬ß€»LṀ - 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 in A (...if the current A isn't now a zero):
 ß     -   call this Link (i.e. f(A=E))
    L  - length of A - Note that zero has length one.
   »   - maximum (vectorises)
     Ṁ - maximum (of the resulting list)

Jelly,  7  6 bytes

¬ß€»LṀ

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?

¬ß€»LṀ - 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, in A (...if the current A isn't now a zero):
 ß     -   call this Link (i.e. f(A=E))
    L  - length of A - Note that zero has length one.
   »   - maximum (vectorises)
     Ṁ - maximum (of the resulting list)
added 22 characters in body
Source Link
Jonathan Allan
  • 110.1k
  • 7
  • 65
  • 282

Jelly, 7  7  6 bytes

¬ß€;LFṀ¬ß€»LṀ

Try it online!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Ṁ¬ß€»LṀ - 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 in A (...if the current A isn't now a zero):
 ß      -   call this Link (i.e. f(A=E))
    L   - length of A
  - ;Note that zero has -length concatenateone.
    » F  - flatten
maximum (vectorises)
     Ṁ - maximum (of the resulting list)

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

Jelly,  7  6 bytes

¬ß€»LṀ

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?

¬ß€»LṀ - 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 in A (...if the current A isn't now a zero):
 ß     -   call this Link (i.e. f(A=E))
    L  - length of A - Note that zero has length one.
   »   - maximum (vectorises)
     Ṁ - maximum (of the resulting list)
Source Link
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