reference solution is in preloaded, and thus accessible for the user. Even though test cases are generated with the answer known upfront, so reference solution is not even necessary.
user can modify input by changing the header of solution function
a bunch of missing includes and misused using std: string, vector, cstdlib, in most of the snippets
input shuold be passed by const ref and not by value
random generator is not seeded
after rng is seeded, random tests have poor coverage, they almost never generate a wolf at front
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...)
It's smart but for sure it may cause some misunderstanding when someone reads it
Rejecting, because:
using std
:string
,vector
,cstdlib
, in most of the snippetsDone :)
C++ Translation
Ruby Translation
"A wolf in sheep's clothing" C++ Translation
Merge conflict.
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'Although this is nice and concise, it's an O(nlogn) algorithm, when an O(n) solution is possible.
Loading more items...