Skip to content

Instantly share code, notes, and snippets.

@mame mame/README.md Secret
Last active May 21, 2019

Embed
What would you like to do?
"Cookpad Daily Ruby Puzzles" in RubyKaigi 2019 - All problems

Cookpad Daily Ruby Puzzles

The Cookpad booth event in RubyKaigi 2019

See also the extra stage!

Day-1

  • puzzle-1-1.rb: authored by @ko1
  • puzzle-1-2.rb: authored by @ko1
  • puzzle-1-3.rb: authored by @mame

Day-2

  • puzzle-2-1.rb: authored by @ko1
  • puzzle-2-2.rb: authored by @mame
  • puzzle-2-3.rb: authored by @mame

Day-3

  • puzzle-3-1.rb: authored by @ko1
  • puzzle-3-2.rb: authored by @mame
  • puzzle-3-3.rb: authored by @mame
# Hint: Use Ruby 2.6.
puts "#{"Goodbye" .. "Hello"} world"
puts&.then {
# Hint: &. is a safe
# navigation operator.
"Hello world"
}
include Math
# Hint: the most beautiful equation
Out, *,
Count = $>,
$<, E ** (2 * PI)
Out.puts("Hello world" *
Count.abs.round)
def say
-> {
"Hello world"
}
# Hint: You should call the Proc.
yield
end
puts say { "Goodbye world" }
e = Enumerator.new do |g|
# Hint: Enumerator is
# essentially Fiber.
yield "Hello world"
end
puts e.next
$s = 0
def say(n = 0)
$s = $s * 4 + n
end
i, j, k = 1, 2, 3
say i
say j
say k
# Hint: Binary representation.
$s != 35 or puts("Hello world")
def say s="Hello", t:'world'
"#{ s }#{ t } world"
end
# Hint: Arguments in Ruby are
# difficult.
puts say :p
def say s, t="Goodbye "
# Hint: You can ignore a warning.
s = "#{ s } #{ t }"
t + "world"
end
puts say :Hello
def say
"Hello world" if
false && false
# Hint: No hint!
end
puts say
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.