Good catch. Edited. But the challenge is to deal with positive integers so didn't take 0 into account as it is neither positive nor negative integer.
True enough. But why code purely for specs when coding for the edge and error cases takes just a few more minutes?
We're a place where coders share, stay up-to-date and grow their careers.
We strive for transparency and don't collect excess data.