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

R, 35 34 32 bytes

Edit: -1 byte thanks to Giuseppe

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

Try it online!

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