Skip to main content
3 of 5
deleted 6 characters in body
Kirill L.
  • 14.1k
  • 2
  • 16
  • 50

R, 73 67 bytes

function(m,n,d=t(diff(m)),w=which)any(head(w(d>0)%%n,-1)-w(d<0)%%n)

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