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

deleted 27 characters in body
Source Link
att
  • 22.8k
  • 2
  • 19
  • 70

Wolfram Language (Mathematica), (削除) 107 (削除ここまで)(削除) 105 (削除ここまで)(削除) 101 (削除ここまで)(削除) 100 ... 100 97 (削除ここまで) 9794 bytes

FreeQ[#|r/@#,#|r@#&@FreeQ[#|Reverse@#&@{z={y=0...}...,de:{a:y,o=11..,b:o,y}..,{a:y,bc:om_..,d:n_..,b:y}..,z}/;+b==Max@+d]&
r=Reverse;c+d==Max@+e]

Try it online! Try it online!

The pattern identifies a vertically reflectedan L shape. Reversing it checks for another vertical reflection; #|r/@# checks for horizontal reflection with the long leg on top.

FreeQ[
{ (* L } pattern: *)
 z={y=0...}..., {a:y, ,b:y}..,{a:y, (* zero or more leading zero-lines,b:y}..,z followed by *) margin of 0s
 d e:{a:y,o=1 1..,b:o,y}.., (* rows of 1s, wider than *)
 {a c:ym_..,bd:o,y}n_.., }.. rows with two distinct parts (*..01.. or more..10..)
#|Reverse@#&@ rows% of 1s, left-aligned with the first column, *)
 z (* and zero or more trailing zero-lines, *) or reflected
}/;+b==Max@+d;c+d==Max@+e (* such that the width of the second row is equal to the height of the first. *) enforce leg widths
]

Wolfram Language (Mathematica), (削除) 107 (削除ここまで)(削除) 105 (削除ここまで)(削除) 101 (削除ここまで)(削除) 100 (削除ここまで) 97 bytes

FreeQ[#|r/@#,#|r@#&@{z={y=0...}...,d:{a:y,o=1..,b:o,y}..,{a:y,b:o,y}..,z}/;+b==Max@+d]&
r=Reverse

Try it online!

The pattern identifies a vertically reflected L shape. Reversing it checks for another vertical reflection; #|r/@# checks for horizontal reflection.

{ (* L pattern: *)
 z={y=0...}..., (* zero or more leading zero-lines, followed by *)
 d:{a:y,o=1..,b:o,y}.., (* rows of 1s, wider than *)
 {a:y,b:o,y}.., (* more rows of 1s, left-aligned with the first column, *)
 z (* and zero or more trailing zero-lines, *)
}/;+b==Max@+d (* such that the width of the second row is equal to the height of the first. *)

Wolfram Language (Mathematica), (削除) 107 ... 100 97 (削除ここまで) 94 bytes

FreeQ[#|Reverse@#&@{z={y=0...}...,e:{a:y,1..,b:y}..,{a:y,c:m_..,d:n_..,b:y}..,z}/;c+d==Max@+e]

Try it online!

The pattern identifies an L shape with the long leg on top.

FreeQ[
{ } pattern:
 z={y=0...}..., {a:y, ,b:y}..,{a:y, ,b:y}..,z  margin of 0s
  e:{ 1..}.. rows of 1s { c:m_..,d:n_.. }.. rows with two distinct parts (..01.. or ..10..)
#|Reverse@#&@ %  or reflected
/;c+d==Max@+e  enforce leg widths
]
deleted 27 characters in body
Source Link
att
  • 22.8k
  • 2
  • 19
  • 70

Wolfram Language (Mathematica), (削除) 107 (削除ここまで) (削除) 105 (削除ここまで) (削除) 101 (削除ここまで) 100(削除) 100 (削除ここまで) 97 bytes

FreeQ[#|r/@#,#|r@#&@{z={y=0...}...,d:{a:y,o=1..,b:o,y}..,{a:y,b:o,y}..,z}/;+b==Length@!d]&;+b==Max@+d]&
r=Reverse

Try it online! Try it online!

The pattern identifies a vertically reflected L shape. Reversing it checks for another vertical reflection (upright);reflection; #|r/@# checks for horizontal reflection.

{ (* L pattern: *)
 z={y=0...}..., (* zero or more leading zero-lines, followed by *)
 d:{a:y,o=1..,b:o,y}.., (* a columnrows of 1s, wider than *)
 {a:y,b:o,y}.., (* anothermore columnrows of 1s, left-aligned with the first column, *)
 z (* and zero or more trailing zero-lines, *)
}/;+b==Length@!d ;+b==Max@+d (* such that the width of the second columnrow is equal to the height of the first. *)

Wolfram Language (Mathematica), (削除) 107 (削除ここまで) (削除) 105 (削除ここまで) (削除) 101 (削除ここまで) 100 bytes

FreeQ[#|r/@#,#|r@#&@{z={y=0...}...,d:{a:y,o=1..,b:o,y}..,{a:y,b:o,y}..,z}/;+b==Length@!d]&
r=Reverse

Try it online!

The pattern identifies a vertically reflected L shape. Reversing it checks for another vertical reflection (upright); #|r/@# checks for horizontal reflection.

{ (* L pattern: *)
 z={y=0...}..., (* zero or more leading zero-lines, followed by *)
 d:{a:y,o=1..,b:o,y}.., (* a column of 1s, wider than *)
 {a:y,b:o,y}.., (* another column of 1s, left-aligned with the first column, *)
 z (* and zero or more trailing zero-lines, *)
}/;+b==Length@!d  (* such that the width of the second column is equal to the height of the first. *)

Wolfram Language (Mathematica), (削除) 107 (削除ここまで) (削除) 105 (削除ここまで) (削除) 101 (削除ここまで) (削除) 100 (削除ここまで) 97 bytes

FreeQ[#|r/@#,#|r@#&@{z={y=0...}...,d:{a:y,o=1..,b:o,y}..,{a:y,b:o,y}..,z}/;+b==Max@+d]&
r=Reverse

Try it online!

The pattern identifies a vertically reflected L shape. Reversing it checks for another vertical reflection; #|r/@# checks for horizontal reflection.

{ (* L pattern: *)
 z={y=0...}..., (* zero or more leading zero-lines, followed by *)
 d:{a:y,o=1..,b:o,y}.., (* rows of 1s, wider than *)
 {a:y,b:o,y}.., (* more rows of 1s, left-aligned with the first column, *)
 z (* and zero or more trailing zero-lines, *)
}/;+b==Max@+d (* such that the width of the second row is equal to the height of the first. *)
added 18 characters in body
Source Link
att
  • 22.8k
  • 2
  • 19
  • 70

Wolfram Language (Mathematica), (削除) 107 (削除ここまで) (削除) 105 (削除ここまで) 101(削除) 101 (削除ここまで) 100 bytes

FreeQ[#|r/@#,#|r@#&@{z={y=0...}...,d:{a:y,b:1o=1..,b:o,y}..,d:{a:y,cb:1..o,y}..,z}/;+c>+b==Length@;+b==Length@!d]&
r=Reverse

Try it online! Try it online!

The pattern identifies an uprighta vertically reflected L shape. Reversing it checks for another vertical reflection;reflection (upright); #|r/@# checks for horizontal reflection.

{ (* L pattern: *)
 z={y=0...}..., (* zero or more leading zero-lines, followed by *)
 d:{a:y,b:1o=1..,b:o,y}.., (* a column of 1s, followedwider bythan *)
 d:{a:y,cb:1..o,y}.., (* another column of 1s, aligned on the left-aligned with the first column, *)
 z (* and zero or more trailing zero-lines, *)
}/;+c>+b==Length@;+b==Length@!d (* such that the second column iswidth wider,of andthe itssecond heightcolumn is equal to the widthheight of the first. *)

Wolfram Language (Mathematica), (削除) 107 (削除ここまで) (削除) 105 (削除ここまで) 101 bytes

FreeQ[#|r/@#,#|r@#&@{z={y=0...}...,{a:y,b:1..,y}..,d:{a:y,c:1..,y}..,z}/;+c>+b==Length@!d]&
r=Reverse

Try it online!

The pattern identifies an upright L shape. Reversing it checks for vertical reflection; #|r/@# checks for horizontal reflection.

{ (* L pattern: *)
 z={y=0...}..., (* zero or more leading zero-lines, followed by *)
 {a:y,b:1..,y}.., (* a column of 1s, followed by *)
 d:{a:y,c:1..,y}.., (* another column of 1s, aligned on the left with the first column, *)
 z (* and zero or more trailing zero-lines, *)
}/;+c>+b==Length@!d (* such that the second column is wider, and its height is equal to the width of the first. *)

Wolfram Language (Mathematica), (削除) 107 (削除ここまで) (削除) 105 (削除ここまで) (削除) 101 (削除ここまで) 100 bytes

FreeQ[#|r/@#,#|r@#&@{z={y=0...}...,d:{a:y,o=1..,b:o,y}..,{a:y,b:o,y}..,z}/;+b==Length@!d]&
r=Reverse

Try it online!

The pattern identifies a vertically reflected L shape. Reversing it checks for another vertical reflection (upright); #|r/@# checks for horizontal reflection.

{ (* L pattern: *)
 z={y=0...}..., (* zero or more leading zero-lines, followed by *)
 d:{a:y,o=1..,b:o,y}.., (* a column of 1s, wider than *)
 {a:y,b:o,y}.., (* another column of 1s, left-aligned with the first column, *)
 z (* and zero or more trailing zero-lines, *)
}/;+b==Length@!d (* such that the width of the second column is equal to the height of the first. *)
deleted 16 characters in body
Source Link
att
  • 22.8k
  • 2
  • 19
  • 70
Loading
added 600 characters in body
Source Link
att
  • 22.8k
  • 2
  • 19
  • 70
Loading
added 7 characters in body
Source Link
att
  • 22.8k
  • 2
  • 19
  • 70
Loading
Source Link
att
  • 22.8k
  • 2
  • 19
  • 70
Loading

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