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 101 characters in body
Source Link
Laikoni
  • 26.4k
  • 7
  • 54
  • 116

Haskell, (削除) 113 (削除ここまで) (削除) 107 (削除ここまで) 103(削除) 103 (削除ここまで) 101 bytes

((#)=<<length=<<k).map lengthk.lines;1#x=0;l#x|x==[1lines;k=length;1#x=0;l#x|x==[1..l]
 ||x==[l,l-1..1]=3;l#x=sum[1|z<1]=3;l#x=k[1|z<-[l,x!!0],all(==z)x]

Try it online! Try it online!

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

Edit: -2 bytes thanks to Lynn !

Haskell, (削除) 113 (削除ここまで) (削除) 107 (削除ここまで) 103 bytes

((#)=<<length).map length.lines;1#x=0;l#x|x==[1..l]
 ||x==[l,l-1..1]=3;l#x=sum[1|z<-[l,x!!0],all(==z)x]

Try it online!

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

Haskell, (削除) 113 (削除ここまで) (削除) 107 (削除ここまで) (削除) 103 (削除ここまで) 101 bytes

((#)=<<k).map k.lines;k=length;1#x=0;l#x|x==[1..l]
 ||x==[l,l-1..1]=3;l#x=k[1|z<-[l,x!!0],all(==z)x]

Try it online!

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

Edit: -2 bytes thanks to Lynn !

deleted 350 characters in body
Source Link
Laikoni
  • 26.4k
  • 7
  • 54
  • 116

Haskell, (削除) 113 (削除ここまで) 107(削除) 107 (削除ここまで) 103 bytes

((#)=<<length).map length.lines;1#x=0;l#x|x==[1..l]
 ||x==[l,l-1..1]=3;l#x=sum
 [1|z<1]=3;l#x=sum[1|z<-[l,x!!0],all(==z)x]

Try it online! Try it online!

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

Haskell, (削除) 113 (削除ここまで) 107 bytes

((#)=<<length).map length.lines;1#x=0;l#x|x==[1..l]
 ||x==[l,l-1..1]=3;l#x=sum
 [1|z<-[l,x!!0],all(==z)x]

Try it online!

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

Haskell, (削除) 113 (削除ここまで) (削除) 107 (削除ここまで) 103 bytes

((#)=<<length).map length.lines;1#x=0;l#x|x==[1..l]
 ||x==[l,l-1..1]=3;l#x=sum[1|z<-[l,x!!0],all(==z)x]

Try it online!

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

added 419 characters in body
Source Link
Laikoni
  • 26.4k
  • 7
  • 54
  • 116

Haskell, 113(削除) 113 (削除ここまで) 107 bytes

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

Try it online! Try it online!

Returns 0, 1, 2 and 3 for squaremess, rectangle, trianglesquare and messtriangle, respectively.

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.

Haskell, (削除) 113 (削除ここまで) 107 bytes

((#)=<<length).map length.
 lines;1#x=0;l#x|x==[1..l]
 ||x==[l,l-1..1]=3;l#x=sum
 [1|z<-[l,x!!0],all(==z)x]

Try it online!

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

Source Link
Laikoni
  • 26.4k
  • 7
  • 54
  • 116
Loading

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