APL (Dyalog Unicode), 22 17 bytes
∊({⍵+⍳≢⍵}¨+\∘≠⊆⊢)
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.
∊({⍵+⍳≢⍵}¨+\∘≠⊆⊢)
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.