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

Bounty Awarded with 50 reputation awarded by user41805
explanation
Source Link
ngn
  • 15.6k
  • 2
  • 45
  • 90

APL (Dyalog Unicode), 44 bytes

thanks @Adám for the ⍸⍣ ̄1 trick

(⊂a)∊(⍉ ̈⊢,⌽ ̈)⍣2≥∘i ̈⍳⌈/,i←⌊/↑⍳⍴a←⍸⍣ ̄1(⊢-⌊/)⍸⎕

Try it online!

⍸⍣ ̄1(⊢-⌊/)⍸ trim surrounding 0s

≥∘i ̈⍳⌈/,i←⌊/↑⍳⍴a generate L-shapes

(⍉ ̈⊢,⌽ ̈)⍣2 add reflections

(⊂a)∊ test if the (trimmed) input is among them

APL (Dyalog Unicode), 44 bytes

thanks @Adám for the ⍸⍣ ̄1 trick

(⊂a)∊(⍉ ̈⊢,⌽ ̈)⍣2≥∘i ̈⍳⌈/,i←⌊/↑⍳⍴a←⍸⍣ ̄1(⊢-⌊/)⍸⎕

Try it online!

APL (Dyalog Unicode), 44 bytes

thanks @Adám for the ⍸⍣ ̄1 trick

(⊂a)∊(⍉ ̈⊢,⌽ ̈)⍣2≥∘i ̈⍳⌈/,i←⌊/↑⍳⍴a←⍸⍣ ̄1(⊢-⌊/)⍸⎕

Try it online!

⍸⍣ ̄1(⊢-⌊/)⍸ trim surrounding 0s

≥∘i ̈⍳⌈/,i←⌊/↑⍳⍴a generate L-shapes

(⍉ ̈⊢,⌽ ̈)⍣2 add reflections

(⊂a)∊ test if the (trimmed) input is among them

Source Link
ngn
  • 15.6k
  • 2
  • 45
  • 90

APL (Dyalog Unicode), 44 bytes

thanks @Adám for the ⍸⍣ ̄1 trick

(⊂a)∊(⍉ ̈⊢,⌽ ̈)⍣2≥∘i ̈⍳⌈/,i←⌊/↑⍳⍴a←⍸⍣ ̄1(⊢-⌊/)⍸⎕

Try it online!

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