It's smart but for sure it may cause some misunderstanding when someone reads it
"A wolf in sheep's clothing" C++ Translation
join takes a block argument; map is unnecessary.
Genius! That's my fault :(
ok, I forfeited ruby version: you're actually running into the usual trip: you're mutating the input, I bet?
I'm not sure... thing is: I hardcoded the results to get to the random tests, then never encountered the error. Maybe you've run into some kind of weird interaction with some variable or function with the same name than the one from the reference solution? (since everything is in the same global scope, in ruby tests...)
I think it should from author's solution because of "in sltn" ?
it comes from your own solution. ;)
[Ruby] Anybody can fix this?
#<NoMethodError: undefined method >' for nil:NilClass> main.rb:82:in sltn'
>' for nil:NilClass> main.rb:82:in
Although this is nice and concise, it's an O(nlogn) algorithm, when an O(n) solution is possible.