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 4
Laikoni
  • 26.4k
  • 7
  • 54
  • 116

Haskell, 113 bytes

((#)=<<length).map
 length.lines;1#x=
 3;l#x@(y:_)|x==[1
 ..l]||x==[l,l-1..
 1]=2|all(==l)x=0|
 all(==y)x=1;_#_=3

Try it online!

Returns 0, 1, 2 and 3 for square, rectangle, triangle and mess, respectively.

Laikoni
  • 26.4k
  • 7
  • 54
  • 116

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