Last active
November 28, 2023 22:23
-
-
Save ParadoxV5/fbb5bf9e51e719eafa0b1b5689539971 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def answer1(n) = n.succ | |
def answer2(str) = str.upcase | |
def answer3(n) = (0..n).to_a | |
def answer4 = yield + 42 | |
def answer5(a, b = 1) = a + b | |
def answer6(n) = n.positive? ? (n - 1) % 9 + 1 : n | |
def answer7(x) = x.succ | |
def answer8(n) = n.digits(2).sum | |
def answer9(s) = s.gsub 'u-g0t-me', 'yikes' | |
def answer10(x = false) = @data10 = x ? 0 : @data10 ? @data10 + 1 : 1 | |
def answer11(x) = x.hash | |
def answer12(s) = s.to_s.each_char.tally.each_value.inject(&:*) | |
def answer13(i) = Encoding.list[i]&.name&.slice(0, 2) | |
def answer14(i) = 'ZOTTFFSSENTE'[ i<12 ? i : i<20 ? i-10 : i<100 ? i/10 : i/100 ] | |
def answer15(i) = (@cache15 ||= Object.constants.sort!)[i]&.slice(0, 2) | |
def answer16(&blk) = (blk.call { return true }; false) | |
def answer17(x) = JS.eval "alert(#{x.inspect})" | |
def answer18(str) = str.scan(/\d+|\D/).map do Integer _1 rescue _1 end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment