Skip to main content
deleted 595 characters in body
Source Link
user
  • 387
  • 2
  • 21
  • 68

APL (Dyalog Unicode), 22 17 1710 bytes

∊({⍵+⍳≢⍵}¨+\∘≠⊆⊢)

Try it online!

Monadic doesn't work on TIO because it's got an older version of Dyalog APL, so I've defined a function USaved 7 bytes thanks to stand in for that.ovs!

Another solution with , 20 bytes

{⍵+(⊣×1+⊢)/∘⌽¨,\~≠⍵⊂⍺+⍳≢⍵}

Try it online!Try it online!

APL (Dyalog Unicode), 22 17 bytes

∊({⍵+⍳≢⍵}¨+\∘≠⊆⊢)

Try it online!

Monadic doesn't work on TIO because it's got an older version of Dyalog APL, so I've defined a function U to stand in for that.

Another solution with , 20 bytes

{⍵+(⊣×1+⊢)/∘⌽¨,\~≠⍵}

Try it online!

APL (Dyalog Unicode), 22 17 10 bytes

Saved 7 bytes thanks to ovs!

{⊂⍺+⍳≢⍵}

Try it online!

added 475 characters in body
Source Link
user
  • 387
  • 2
  • 21
  • 68

APL (Dyalog Unicode), 22 17 bytes

∊({⍵+⍳≢⍵}¨+\∘≠⊆⊢)

Try it online!

Monadic doesn't work on TIO because it's got an older version of Dyalog APL, so I've defined a function U to stand in for that.

Another solution with , 20 bytes

{⍵+(⊣×1+⊢)/∘⌽¨,\~≠⍵}

Try it online!

APL (Dyalog Unicode), 22 17 bytes

∊({⍵+⍳≢⍵}¨+\∘≠⊆⊢)

Try it online!

Monadic doesn't work on TIO because it's got an older version of Dyalog APL, so I've defined a function U to stand in for that.

APL (Dyalog Unicode), 22 17 bytes

∊({⍵+⍳≢⍵}¨+\∘≠⊆⊢)

Try it online!

Monadic doesn't work on TIO because it's got an older version of Dyalog APL, so I've defined a function U to stand in for that.

Another solution with , 20 bytes

{⍵+(⊣×1+⊢)/∘⌽¨,\~≠⍵}

Try it online!

added 425 characters in body
Source Link
user
  • 387
  • 2
  • 21
  • 68

APL (Dyalog Unicode), 2222 17 bytes

∊({⍵+⍳≢⍵}¨⊢⊆⍨⊢+1+∘|⌊/¨+\∘≠⊆⊢)

Try it online!Try it online!

I was hoping for an extremely short answer usingMonadic , but it doesn't allow negative numbers (on the left). Explanation coming.

APL (Dyalog Unicode), 17 bytes

∊({⍵+⍳≢⍵}¨+\∘≠⊆⊢)

Try it online!

Doesn't work on TIO because it's got an older version of Dyalog APL, so I've defined a function U to stand in for that.

APL (Dyalog Unicode), 22 bytes

∊({⍵+⍳≢⍵}¨⊢⊆⍨⊢+1+∘|⌊/)

Try it online!

I was hoping for an extremely short answer using , but it doesn't allow negative numbers (on the left). Explanation coming.

APL (Dyalog Unicode), 17 bytes

∊({⍵+⍳≢⍵}¨+\∘≠⊆⊢)

Try it online!

Doesn't work on TIO

APL (Dyalog Unicode), 22 17 bytes

∊({⍵+⍳≢⍵}¨+\∘≠⊆⊢)

Try it online!

Monadic doesn't work on TIO because it's got an older version of Dyalog APL, so I've defined a function U to stand in for that.

added 425 characters in body
Source Link
user
  • 387
  • 2
  • 21
  • 68
Loading
Source Link
user
  • 387
  • 2
  • 21
  • 68
Loading