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

1 of 2
dingledooper
  • 23.4k
  • 1
  • 40
  • 130

Python 2, 49 bytes

Takes as input a 2D binary matrix \$ a \$, and its size \$ n \$.

lambda a,n:sorted(map(sum,a+zip(*a)))[-2:]==[1,n]

Try it online!

There may be shorter approaches, but this is what I could find for now. Please let me know if the algorithm is incorrect.

dingledooper
  • 23.4k
  • 1
  • 40
  • 130

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