Skip to main content
added 8 characters in body
Source Link
Dominic van Essen
  • 36.4k
  • 2
  • 22
  • 60

R, 35 3434 32 bytes

Edit: -1 byte thanks to Giuseppe

function(x)rep(x[!seqx,`[<-`(!x)%%2],e=20:1*2))

Try it online!Try it online!

R, 35 34 bytes

Edit: -1 byte thanks to Giuseppe

function(x)rep(x[!seq(!x)%%2],e=2)

Try it online!

R, 35 34 32 bytes

Edit: -1 byte thanks to Giuseppe

function(x)rep(x,`[<-`(x,0:1*2))

Try it online!

added 44 characters in body
Source Link
Dominic van Essen
  • 36.4k
  • 2
  • 22
  • 60

R, 3535 34 bytes

Edit: -1 byte thanks to Giuseppe

function(x)rep(x[seqx[!seq(!x)%%2<1]%%2],e=2)

Try it online!Try it online!

R, 35 bytes

function(x)rep(x[seq(!x)%%2<1],e=2)

Try it online!

R, 35 34 bytes

Edit: -1 byte thanks to Giuseppe

function(x)rep(x[!seq(!x)%%2],e=2)

Try it online!

Source Link
Dominic van Essen
  • 36.4k
  • 2
  • 22
  • 60

R, 35 bytes

function(x)rep(x[seq(!x)%%2<1],e=2)

Try it online!