Skip to main content
Commonmark migration
Source Link

Jelly, 9 bytes

Ẇ=J$Ḅ⁼ɗƇ1

A monadic Link accepting a list of integers which yields a list of lists of integers.

Try it online!

Or ẆĖE€Ḅ⁼ʋƇ1 - Try it.

How?

Ẇ=J$Ḅ⁼ɗƇ1 - Link: list of integers
Ẇ         - all sublists
        1 - set right argument to 1
       Ƈ  - filter keep those (sublists) for which:
      ɗ   -   last three links as a dyad - i.e. f(sublist, 1):
   $      -     last two links as a monad i.e. g(sublist)
  J       -       range of length = [1,2,3,...,length]
 =        -       (sublist) equals (that)? (vectorises)
    Ḅ     -     from binary
     ⁼    -     (that) equals (1)?

Jelly, 9 bytes

Ẇ=J$Ḅ⁼ɗƇ1

A monadic Link accepting a list of integers which yields a list of lists of integers.

Try it online!

Or ẆĖE€Ḅ⁼ʋƇ1 - Try it.

How?

Ẇ=J$Ḅ⁼ɗƇ1 - Link: list of integers
Ẇ         - all sublists
        1 - set right argument to 1
       Ƈ  - filter keep those (sublists) for which:
      ɗ   -   last three links as a dyad - i.e. f(sublist, 1):
   $      -     last two links as a monad i.e. g(sublist)
  J       -       range of length = [1,2,3,...,length]
 =        -       (sublist) equals (that)? (vectorises)
    Ḅ     -     from binary
     ⁼    -     (that) equals (1)?

Jelly, 9 bytes

Ẇ=J$Ḅ⁼ɗƇ1

A monadic Link accepting a list of integers which yields a list of lists of integers.

Try it online!

Or ẆĖE€Ḅ⁼ʋƇ1 - Try it.

How?

Ẇ=J$Ḅ⁼ɗƇ1 - Link: list of integers
Ẇ         - all sublists
        1 - set right argument to 1
       Ƈ  - filter keep those (sublists) for which:
      ɗ   -   last three links as a dyad - i.e. f(sublist, 1):
   $      -     last two links as a monad i.e. g(sublist)
  J       -       range of length = [1,2,3,...,length]
 =        -       (sublist) equals (that)? (vectorises)
    Ḅ     -     from binary
     ⁼    -     (that) equals (1)?
added 11 characters in body
Source Link
Jonathan Allan
  • 110.1k
  • 7
  • 65
  • 282

Jelly, 9 bytes

Ẇ=J$Ḅ⁼ɗƇ1

A monadic Link accepting a list of integers which yields a list of lists of integers.

Try it online!

Or ẆĖE€Ḅ⁼ʋƇ1 - Try it.

How?

Ẇ=J$Ḅ⁼ɗƇ1 - Link: list of integers
Ẇ         - all sublists
        1 - set right argument to 1
       Ƈ  - filter keep those (sublists) for which:
      ɗ   -   last three links as a dyad - i.e. f(sublist, 1):
   $      -     last two links as a monad i.e. g(sublist)
  J       -       range of length = [1,2,3,...,length]
 =        -       (sublist) equals (that)? (vectorises)
    Ḅ     -     from binary
     ⁼    -     (that) equals (1)?

Jelly, 9 bytes

Ẇ=J$Ḅ⁼ɗƇ1

A monadic Link accepting a list of integers which yields a list of lists of integers.

Try it online!

Or ẆĖE€Ḅ⁼ʋƇ1 - Try it.

How?

Ẇ=J$Ḅ⁼ɗƇ1 - Link: list of integers
Ẇ         - all sublists
        1 - set right argument to 1
       Ƈ  - filter keep those for which:
      ɗ   -   last three links as a dyad - i.e. f(sublist, 1):
   $      -     last two links as a monad i.e. g(sublist)
  J       -       range of length = [1,2,3,...,length]
 =        -       (sublist) equals (that)? (vectorises)
    Ḅ     -     from binary
     ⁼    -     (that) equals (1)?

Jelly, 9 bytes

Ẇ=J$Ḅ⁼ɗƇ1

A monadic Link accepting a list of integers which yields a list of lists of integers.

Try it online!

Or ẆĖE€Ḅ⁼ʋƇ1 - Try it.

How?

Ẇ=J$Ḅ⁼ɗƇ1 - Link: list of integers
Ẇ         - all sublists
        1 - set right argument to 1
       Ƈ  - filter keep those (sublists) for which:
      ɗ   -   last three links as a dyad - i.e. f(sublist, 1):
   $      -     last two links as a monad i.e. g(sublist)
  J       -       range of length = [1,2,3,...,length]
 =        -       (sublist) equals (that)? (vectorises)
    Ḅ     -     from binary
     ⁼    -     (that) equals (1)?
added 629 characters in body
Source Link
Jonathan Allan
  • 110.1k
  • 7
  • 65
  • 282

Jelly, 9 bytes

Ẇ=J$Ḅ⁼ɗƇ1

A monadic Link accepting a list of integers which yields a list of lists of integers.

Try it online!

Or ẆĖE€Ḅ⁼ʋƇ1 - Try it.

How?

Ẇ=J$Ḅ⁼ɗƇ1 - Link: list of integers
Ẇ         - all sublists
        1 - set right argument to 1
       Ƈ  - filter keep those for which:
      ɗ   -   last three links as a dyad - i.e. f(sublist, 1):
   $      -     last two links as a monad i.e. g(sublist)
  J       -       range of length = [1,2,3,...,length]
 =        -       (sublist) equals (that)? (vectorises)
    Ḅ     -     from binary
     ⁼    -     (that) equals (1)?

Jelly, 9 bytes

Ẇ=J$Ḅ⁼ɗƇ1

A monadic Link accepting a list of integers which yields a list of lists of integers.

Try it online!

Jelly, 9 bytes

Ẇ=J$Ḅ⁼ɗƇ1

A monadic Link accepting a list of integers which yields a list of lists of integers.

Try it online!

Or ẆĖE€Ḅ⁼ʋƇ1 - Try it.

How?

Ẇ=J$Ḅ⁼ɗƇ1 - Link: list of integers
Ẇ         - all sublists
        1 - set right argument to 1
       Ƈ  - filter keep those for which:
      ɗ   -   last three links as a dyad - i.e. f(sublist, 1):
   $      -     last two links as a monad i.e. g(sublist)
  J       -       range of length = [1,2,3,...,length]
 =        -       (sublist) equals (that)? (vectorises)
    Ḅ     -     from binary
     ⁼    -     (that) equals (1)?
Source Link
Jonathan Allan
  • 110.1k
  • 7
  • 65
  • 282
Loading