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 11 characters in body
Source Link
vrintle
  • 3k
  • 1
  • 14
  • 34

Ruby 2.7, (削除) 112 (削除ここまで)(削除) 98 (削除ここまで)(削除) 77 (削除ここまで)(削除) 112 (削除ここまで)(削除) 98 (削除ここまで)(削除) 77 (削除ここまで) 74 bytes

Saved 6 bytes using String#count method, thanks to Razetime!
Saved 3 bytes using literal newline, thanks to Dingus!

->m{m.map{" "*3+_1}<<?-*(6+c=m[0].size)+"
 | #{" "*c} |"*(m*"").count(?d)}

Try it online!

  • TIO uses an older version of Ruby, while in Ruby 2.7, we've numbered parameters, i.e., _1, which saves 2 bytes.

Ruby 2.7, (削除) 112 (削除ここまで)(削除) 98 (削除ここまで)(削除) 77 (削除ここまで) 74 bytes

Saved 6 bytes using String#count method, thanks to Razetime!
Saved 3 bytes using literal newline, thanks to Dingus!

->m{m.map{" "*3+_1}<<?-*(6+c=m[0].size)+"
 | #{" "*c} |"*(m*"").count(?d)}

Try it online!

  • TIO uses an older version of Ruby, while in Ruby 2.7, we've numbered parameters, i.e., _1, which saves 2 bytes.

Ruby 2.7, (削除) 112 (削除ここまで)(削除) 98 (削除ここまで)(削除) 77 (削除ここまで) 74 bytes

Saved 6 bytes using String#count method, thanks to Razetime!
Saved 3 bytes using literal newline, thanks to Dingus!

->m{m.map{" "*3+_1}<<?-*(6+c=m[0].size)+"
 | #{" "*c} |"*(m*"").count(?d)}

Try it online!

  • TIO uses an older version of Ruby, while in Ruby 2.7, we've numbered parameters, i.e., _1, which saves 2 bytes.
added 5 characters in body
Source Link
vrintle
  • 3k
  • 1
  • 14
  • 34

Ruby 2.7, (削除) 112 (削除ここまで) (削除) 98 (削除ここまで) (削除) 77 (削除ここまで) 74 bytes

Saved 6 bytes using String#count method, thanks to Razetime!
Saved 3 bytes using literal newline, thanks to Dingus!

->m{m.map{" "*3+_1}<<?-*(6+c=m[0].size)+"
 | #{" "*c} |"*(m*"").count(?d)}

Try it online! Try it online!

  • TIO uses an older version of Ruby, while in Ruby 2.7, we've numbered parameters, i.e., _1, which saves 2 bytes.

Ruby 2.7, (削除) 112 (削除ここまで) (削除) 98 (削除ここまで) (削除) 77 (削除ここまで) 74 bytes

Saved 6 bytes using String#count method, thanks to Razetime!
Saved 3 bytes using literal newline, thanks to Dingus!

->m{m.map{" "*3+_1}<<?-*(6+c=m[0].size)+"
 | #{" "*c} |"*(m*"").count(?d)}

Try it online!

  • TIO uses an older version of Ruby, while in Ruby 2.7, we've numbered parameters, i.e., _1, which saves 2 bytes.

Ruby 2.7, (削除) 112 (削除ここまで) (削除) 98 (削除ここまで) (削除) 77 (削除ここまで) 74 bytes

Saved 6 bytes using String#count method, thanks to Razetime!
Saved 3 bytes using literal newline, thanks to Dingus!

->m{m.map{" "*3+_1}<<?-*(6+c=m[0].size)+"
 | #{" "*c} |"*(m*"").count(?d)}

Try it online!

  • TIO uses an older version of Ruby, while in Ruby 2.7, we've numbered parameters, i.e., _1, which saves 2 bytes.
added 113 characters in body
Source Link
vrintle
  • 3k
  • 1
  • 14
  • 34

Ruby 2.7, (削除) 112 (削除ここまで) (削除) 98 (削除ここまで) 77(削除) 77 (削除ここまで) 74 bytes

Saved 6 bytes using String#count method, thanks to Razetime!
Saved 3 bytes using literal newline, thanks to Dingus !

->m{m<<m.map{" "*3+_1}<<?-*(6+c=m[0].size)+"\n+"
 |#| #{" ".*c+2"*c}|"*(m.map!{" "*3+_1}*""m*"").count(?d)}

Try it online! Try it online!

  • TIO uses an older version of Ruby, while in Ruby 2.7, we've numbered parameters, i.e., _1, which saves 2 bytes.

Ruby 2.7, (削除) 112 (削除ここまで) (削除) 98 (削除ここまで) 77 bytes

Saved 6 bytes using String#count method, thanks to Razetime!

->m{m<<?-*(6+c=m[0].size)+"\n |#{" ".*c+2}|"*(m.map!{" "*3+_1}*"").count(?d)}

Try it online!

  • TIO uses an older version of Ruby, while in Ruby 2.7, we've numbered parameters, i.e., _1, which saves 2 bytes.

Ruby 2.7, (削除) 112 (削除ここまで) (削除) 98 (削除ここまで) (削除) 77 (削除ここまで) 74 bytes

Saved 6 bytes using String#count method, thanks to Razetime!
Saved 3 bytes using literal newline, thanks to Dingus !

->m{m.map{" "*3+_1}<<?-*(6+c=m[0].size)+"
 | #{" "*c}|"*(m*"").count(?d)}

Try it online!

  • TIO uses an older version of Ruby, while in Ruby 2.7, we've numbered parameters, i.e., _1, which saves 2 bytes.
added 10 characters in body
Source Link
vrintle
  • 3k
  • 1
  • 14
  • 34
Loading
deleted 25 characters in body
Source Link
vrintle
  • 3k
  • 1
  • 14
  • 34
Loading
deleted 1 character in body
Source Link
vrintle
  • 3k
  • 1
  • 14
  • 34
Loading
added 107 characters in body
Source Link
vrintle
  • 3k
  • 1
  • 14
  • 34
Loading
Source Link
vrintle
  • 3k
  • 1
  • 14
  • 34
Loading

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