Skip to main content
We’ve updated our Terms of Service. A new AI Addendum clarifies how Stack Overflow utilizes AI interactions.
Code Golf

Return to Answer

Commonmark migration
Source Link

Jelly, 8 bytes

ŒœẎ$ƬiṢ’

Try it online!

###How?

How?

ŒœẎ$ƬiṢ’ - Link: list of integers A
 Ƭ - collect up until results are no longer unique...
 $ - last two links as a monad:
Œœ - odds & evens i.e. [a,b,c,d,...] -> [[a,c,...],[b,d,...]]
 Ẏ - tighten -> [a,c,...,b,d,...]
 Ṣ - sort A
 i - first (1-indexed) index of sorted A in collected shuffles
 ’ - decrement

Jelly, 8 bytes

ŒœẎ$ƬiṢ’

Try it online!

###How?

ŒœẎ$ƬiṢ’ - Link: list of integers A
 Ƭ - collect up until results are no longer unique...
 $ - last two links as a monad:
Œœ - odds & evens i.e. [a,b,c,d,...] -> [[a,c,...],[b,d,...]]
 Ẏ - tighten -> [a,c,...,b,d,...]
 Ṣ - sort A
 i - first (1-indexed) index of sorted A in collected shuffles
 ’ - decrement

Jelly, 8 bytes

ŒœẎ$ƬiṢ’

Try it online!

How?

ŒœẎ$ƬiṢ’ - Link: list of integers A
 Ƭ - collect up until results are no longer unique...
 $ - last two links as a monad:
Œœ - odds & evens i.e. [a,b,c,d,...] -> [[a,c,...],[b,d,...]]
 Ẏ - tighten -> [a,c,...,b,d,...]
 Ṣ - sort A
 i - first (1-indexed) index of sorted A in collected shuffles
 ’ - decrement
added 439 characters in body
Source Link
Jonathan Allan
  • 115.4k
  • 8
  • 68
  • 293

Jelly, 8 bytes

ŒœẎ$ƬiṢ’

Try it online!

###How?

ŒœẎ$ƬiṢ’ - Link: list of integers A
 Ƭ - collect up until results are no longer unique...
 $ - last two links as a monad:
Œœ - odds & evens i.e. [a,b,c,d,...] -> [[a,c,...],[b,d,...]]
 Ẏ - tighten -> [a,c,...,b,d,...]
 Ṣ - sort A
 i - first (1-indexed) index of sorted A in collected shuffles
 ’ - decrement

Jelly, 8 bytes

ŒœẎ$ƬiṢ’

Try it online!

Jelly, 8 bytes

ŒœẎ$ƬiṢ’

Try it online!

###How?

ŒœẎ$ƬiṢ’ - Link: list of integers A
 Ƭ - collect up until results are no longer unique...
 $ - last two links as a monad:
Œœ - odds & evens i.e. [a,b,c,d,...] -> [[a,c,...],[b,d,...]]
 Ẏ - tighten -> [a,c,...,b,d,...]
 Ṣ - sort A
 i - first (1-indexed) index of sorted A in collected shuffles
 ’ - decrement
Source Link
Jonathan Allan
  • 115.4k
  • 8
  • 68
  • 293

Jelly, 8 bytes

ŒœẎ$ƬiṢ’

Try it online!

AltStyle によって変換されたページ (->オリジナル) /