Skip to main content
More better
Source Link
Veskah
  • 4.1k
  • 13
  • 29

PowerShell, 7171 69 bytes

-2 bytes thanks to mazzy

$z=92
$args|%{$i+=($x=$x=2*($_-1,1eq92)[$_-eq92]1)*($z-ne$_)
' '*$i+($z=$_)
$i+=$x}

Try it online!Try it online!

Takes input by splatting. This also saves us two bytes because we can just treat it as an int instead of writing '\' which we do twice.

PowerShell, 71 bytes

$z=92
$args|%{$i+=($x=(-1,1)[$_-eq92])*($z-ne$_)
' '*$i+($z=$_)
$i+=$x}

Try it online!

Takes input by splatting. This also saves us two bytes because we can just treat it as an int instead of writing '\' which we do twice.

PowerShell, 71 69 bytes

-2 bytes thanks to mazzy

$z=92
$args|%{$i+=($x=2*($_-eq92)-1)*($z-ne$_)
' '*$i+($z=$_)
$i+=$x}

Try it online!

Takes input by splatting. This also saves us two bytes because we can just treat it as an int instead of writing '\' which we do twice.

Source Link
Veskah
  • 4.1k
  • 13
  • 29

PowerShell, 71 bytes

$z=92
$args|%{$i+=($x=(-1,1)[$_-eq92])*($z-ne$_)
' '*$i+($z=$_)
$i+=$x}

Try it online!

Takes input by splatting. This also saves us two bytes because we can just treat it as an int instead of writing '\' which we do twice.