Shortest code (Ruby)
Tips
Read inputs
see also
String
Split string but keep multiple whitespace
Remove multiple spaces and new lines inside of String
Iterate on String
All prefix of a string
Formatting using String.format / sprintf
Hex/Binary conversion
String Litteral
Character values to Strings && SO
string to number
Hash
Array / Ruby-doc
Array from range
Filter nil
Reverse Sort
On Looping
Apply method on each element
inject operation
sum
repeating text
Word count with Enumerable.tally
p vs puts
call lambda
see also
- eonu/ruby-golf
- Tips for golfing in Ruby
- Code Golf tips of ruby
- ruby-codegolf
- Ruby - code-golf/code-golf GitHub Wiki - char packer trick - But doesn’t work with Codingame which count bytes
- Compression in Golf: Part I - pack(u) trick
- zip - compression
Example
Written on May 29, 2019, Last update on August 9, 2023
ruby
codegolf
codingame
string
array