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

Commonmark migration
Source Link

#Pyth, (削除) 22 (削除ここまで) 21 bytes

Pyth, (削除) 22 (削除ここまで) 21 bytes

This is definitely not the language for matrix manipulation.

.As.e+!MWk.Db,0k,@bkh

For each row b and its index k in the matrix (.e), grabs the first and kth entries (left side and diagonal) with ,@bkh and (+) all the other entries with .Db,0k. If k isn't 0 to correspond to the first row (Wk), then !not M all of those entries. Once all of those have been selected, make sure all of them are true. (.As) If there's a 0 where there shouldn't be, then the corresponding location will be grabbed as is and mess up the and, and if there's a nonzero where there shouldn't be, it'll be ! notted to 0, which is also false.

Test suite.

-1 bytes for swapping the orders around.

#Pyth, (削除) 22 (削除ここまで) 21 bytes

This is definitely not the language for matrix manipulation.

.As.e+!MWk.Db,0k,@bkh

For each row b and its index k in the matrix (.e), grabs the first and kth entries (left side and diagonal) with ,@bkh and (+) all the other entries with .Db,0k. If k isn't 0 to correspond to the first row (Wk), then !not M all of those entries. Once all of those have been selected, make sure all of them are true. (.As) If there's a 0 where there shouldn't be, then the corresponding location will be grabbed as is and mess up the and, and if there's a nonzero where there shouldn't be, it'll be ! notted to 0, which is also false.

Test suite.

-1 bytes for swapping the orders around.

Pyth, (削除) 22 (削除ここまで) 21 bytes

This is definitely not the language for matrix manipulation.

.As.e+!MWk.Db,0k,@bkh

For each row b and its index k in the matrix (.e), grabs the first and kth entries (left side and diagonal) with ,@bkh and (+) all the other entries with .Db,0k. If k isn't 0 to correspond to the first row (Wk), then !not M all of those entries. Once all of those have been selected, make sure all of them are true. (.As) If there's a 0 where there shouldn't be, then the corresponding location will be grabbed as is and mess up the and, and if there's a nonzero where there shouldn't be, it'll be ! notted to 0, which is also false.

Test suite.

-1 bytes for swapping the orders around.

deleted 1 character in body
Source Link
Steven H.
  • 3k
  • 12
  • 22

#Pyth, (削除) 22 (削除ここまで) 21 bytes

This is definitely not the language for matrix manipulation.

.As.e+!MWk.Db,0k,@bkh

For each row b and its index k in the matrix (.e), grabs the first and kth entries (left side and diagonal) with ,@bkh and (+) all the other entries with .Db,0k. If k isn't 0 to correspond to the first row (Wk), then !not M all of those entries. Once all of those have been selected, make sure all of them are true. (.As) If there's a 0 where there shouldn't be, then the corresponding location will be grabbed as is and mess up the and, and if there's a nonzero where there shouldn't be, it'll be ! notted to 0, which is also false.

Test suite. Test suite.

-1 bytes for swapping the orders around.

#Pyth, (削除) 22 (削除ここまで) 21 bytes

This is definitely not the language for matrix manipulation.

.As.e+!MWk.Db,0k,@bkh

For each row b and its index k in the matrix (.e), grabs the first and kth entries (left side and diagonal) with ,@bkh and (+) all the other entries with .Db,0k. If k isn't 0 to correspond to the first row (Wk), then !not M all of those entries. Once all of those have been selected, make sure all of them are true. (.As) If there's a 0 where there shouldn't be, then the corresponding location will be grabbed as is and mess up the and, and if there's a nonzero where there shouldn't be, it'll be ! notted to 0, which is also false.

Test suite.

-1 bytes for swapping the orders around.

#Pyth, (削除) 22 (削除ここまで) 21 bytes

This is definitely not the language for matrix manipulation.

.As.e+!MWk.Db,0k,@bkh

For each row b and its index k in the matrix (.e), grabs the first and kth entries (left side and diagonal) with ,@bkh and (+) all the other entries with .Db,0k. If k isn't 0 to correspond to the first row (Wk), then !not M all of those entries. Once all of those have been selected, make sure all of them are true. (.As) If there's a 0 where there shouldn't be, then the corresponding location will be grabbed as is and mess up the and, and if there's a nonzero where there shouldn't be, it'll be ! notted to 0, which is also false.

Test suite.

-1 bytes for swapping the orders around.

added 8 characters in body
Source Link
Steven H.
  • 3k
  • 12
  • 22

#Pyth, 22(削除) 22 (削除ここまで) 21 bytes

This is definitely not the language for matrix manipulation.

.As.e+,hb@bk!MWk.Db,0k,@bkh

For each row b and its index k in the matrix (.e), grabs the first and kth entries (left side and diagonal) with ,hb@bk@bkh and (+) all the other entries with .Db,0k. If k isn't 0 to correspond to the first row (Wk), then !not M all of those entries. Once all of those have been selected, make sure all of them are true. (.As) If there's a 0 where there shouldn't be, then the corresponding location will be grabbed as is and mess up the and, and if there's a nonzero where there shouldn't be, it'll be ! notted to 0, which is also false.

Test suite.

-1 bytes for swapping the orders around.

#Pyth, 22 bytes

This is definitely not the language for matrix manipulation.

.As.e+,hb@bk!MWk.Db,0k

For each row b and its index k in the matrix (.e), grabs the first and kth entries (left side and diagonal) with ,hb@bk and (+) all the other entries with .Db,0k. If k isn't 0 to correspond to the first row (Wk), then !not M all of those entries. Once all of those have been selected, make sure all of them are true. (.As) If there's a 0 where there shouldn't be, then the corresponding location will be grabbed as is and mess up the and, and if there's a nonzero where there shouldn't be, it'll be ! notted to 0, which is also false.

Test suite.

#Pyth, (削除) 22 (削除ここまで) 21 bytes

This is definitely not the language for matrix manipulation.

.As.e+!MWk.Db,0k,@bkh

For each row b and its index k in the matrix (.e), grabs the first and kth entries (left side and diagonal) with ,@bkh and (+) all the other entries with .Db,0k. If k isn't 0 to correspond to the first row (Wk), then !not M all of those entries. Once all of those have been selected, make sure all of them are true. (.As) If there's a 0 where there shouldn't be, then the corresponding location will be grabbed as is and mess up the and, and if there's a nonzero where there shouldn't be, it'll be ! notted to 0, which is also false.

Test suite.

-1 bytes for swapping the orders around.

Source Link
Steven H.
  • 3k
  • 12
  • 22
Loading

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