Skip to main content
We’ve updated our Terms of Service. A new AI Addendum clarifies how Stack Overflow utilizes AI interactions.
Code Golf

Return to Revisions

2 of 4
added 31 characters in body
Jonathan Allan
  • 115.4k
  • 8
  • 68
  • 293

Python 3, 151 bytes

...or Python 2 150 by changing // to /.

lambda p,e=enumerate:[{sum(b[i+2*n%3-1][j+2*n//5-1]for n in range(8))for b,a in zip(p,p[1:])for i,r in e(b)for j,s in e(r)if s^d<a[i][j]}for d in(0,1)]

An unnamed function that accepts the pattern, p, and returns the minimal B and S as a list of two sets.

Try it online!

Jonathan Allan
  • 115.4k
  • 8
  • 68
  • 293

AltStyle によって変換されたページ (->オリジナル) /