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 Answer

added 250 characters in body
Source Link
att
  • 22.8k
  • 2
  • 19
  • 70

Wolfram Language (Mathematica), 25 bytes

#||#/.{a_..}:>Tr@a==1&

Try it online!

Returns True if the matrix has a single line, and nonTrue otherwise.

#||# input OR its tranpose
 /.{a_..}:> replace lists of repeated elements with
 Tr@a==1 (is the sum of that element equal to 1?)

Then, any Or expression with True as an argument gets reduced to True.

Wolfram Language (Mathematica), 25 bytes

#||#/.{a_..}:>Tr@a==1&

Try it online!

Returns True if the matrix has a single line, and nonTrue otherwise.

Wolfram Language (Mathematica), 25 bytes

#||#/.{a_..}:>Tr@a==1&

Try it online!

Returns True if the matrix has a single line, and nonTrue otherwise.

#||# input OR its tranpose
 /.{a_..}:> replace lists of repeated elements with
 Tr@a==1 (is the sum of that element equal to 1?)

Then, any Or expression with True as an argument gets reduced to True.

Source Link
att
  • 22.8k
  • 2
  • 19
  • 70

Wolfram Language (Mathematica), 25 bytes

#||#/.{a_..}:>Tr@a==1&

Try it online!

Returns True if the matrix has a single line, and nonTrue otherwise.

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