i'll try do my best
IMHO. Code Style is not good
This comment is hidden because it contains spoiler information about the solution
It checks if a number is even. Just an alternative way of saying n % 2 == 0
n % 2 == 0
(n&1) == 0. What is this line doing?
Thank you for your reviewing.
Should check for null though.
Misunderstood circle. Thought it could go two ways.
Wrong if statement. Should be (n < 0 || (n & 1) == 0)
There is a solution that will not time out. I'll make a note on the description. Thanks for the feedback.
Yes, I have missed that case. Thank you for comment.
should note that: 1.return -1 if n<1 2.control the time
I think this is an interesting problem as it's so simple in theory, and the solutions can be really elegant.
Agree completely!
Loading collection data...
i'll try do my best
IMHO. Code Style is not good
This comment is hidden because it contains spoiler information about the solution
It checks if a number is even. Just an alternative way of saying
n % 2 == 0
(n&1) == 0. What is this line doing?
Thank you for your reviewing.
Should check for null though.
Misunderstood circle. Thought it could go two ways.
Wrong if statement. Should be (n < 0 || (n & 1) == 0)
There is a solution that will not time out. I'll make a note on the description. Thanks for the feedback.
Yes, I have missed that case. Thank you for comment.
should note that:
1.return -1 if n<1
2.control the time
This comment is hidden because it contains spoiler information about the solution
Agree completely!
This comment is hidden because it contains spoiler information about the solution
Loading more items...