Skip to main content
1 of 5
Kirill L.
  • 14.1k
  • 2
  • 16
  • 50

R, 73 bytes

function(m,n,d=t(diff(m)),w=which,x=w(d>0)%%n)any(x[seq(y<-w(d<0)%%n)]-y)

Try it online!

Based on the idea in Leo's Husk answer.

Takes input as a matrix m of 1s and 0s with each pattern corresponding to a row, and the size of the pattern n. Outputs a swapped T/F value (in the footer, the results are swapped back).

Kirill L.
  • 14.1k
  • 2
  • 16
  • 50