Skip to main content
Commonmark migration
Source Link

Jelly, 6 bytes

ẆQƑƇṪL

A monadic link accepting a list of characters (or whatever), which yields the length.

Try it online!

###How?

How?

ẆQƑƇṪL - Link: list
Ẇ      - all sublists (ordered by length)
   Ƈ   - filter keep those which are:
  Ƒ    -   invariant under:
 Q     -     deduplication
    Ṫ  - tail
     L - length

Jelly, 6 bytes

ẆQƑƇṪL

A monadic link accepting a list of characters (or whatever), which yields the length.

Try it online!

###How?

ẆQƑƇṪL - Link: list
Ẇ      - all sublists (ordered by length)
   Ƈ   - filter keep those which are:
  Ƒ    -   invariant under:
 Q     -     deduplication
    Ṫ  - tail
     L - length

Jelly, 6 bytes

ẆQƑƇṪL

A monadic link accepting a list of characters (or whatever), which yields the length.

Try it online!

How?

ẆQƑƇṪL - Link: list
Ẇ      - all sublists (ordered by length)
   Ƈ   - filter keep those which are:
  Ƒ    -   invariant under:
 Q     -     deduplication
    Ṫ  - tail
     L - length
Source Link
Jonathan Allan
  • 110.1k
  • 7
  • 65
  • 282

Jelly, 6 bytes

ẆQƑƇṪL

A monadic link accepting a list of characters (or whatever), which yields the length.

Try it online!

###How?

ẆQƑƇṪL - Link: list
Ẇ      - all sublists (ordered by length)
   Ƈ   - filter keep those which are:
  Ƒ    -   invariant under:
 Q     -     deduplication
    Ṫ  - tail
     L - length