Last active
May 8, 2019 22:21
-
-
Save nilsding/0dc88366f1380791405614563094e36b to your computer and use it in GitHub Desktop.
This file contains hidden or 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
# Cursed ways to return 5 without using 0123456789+-*/ | |
[[],[],[],[],[]].size # => 5 | |
Array(?;..??).size # => 5 | |
module Solution3 | |
def self.method_missing(name) | |
return name.size if name =~ %r{^.....$} # => 0 | |
super | |
end # => :method_missing | |
end # => :method_missing | |
Solution3.honk! # => 5 | |
proc{def a;raise ??;rescue;yield;end;begin;eval"proc#{eval"'aaaaa'.gsub(%r{.},\"{\\\\#{?}.to_i}}\").chars.sort{|c|c==?}???.to_i.succ: ??.to_i}.join"}[]";rescue=>e;end;d=?d.to_i;d=d.succ while e=e.cause;d}[] # => 5 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment