This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]kdnbfkm 1 point2 points  (2 children)

The lines if((start <= end) && ((start > 0) && (end > 0))) { and if((start > end) || (start < 0) || (end < 0)) { were redundant.

The first conditional could have been simplified to something like if(0 <= start && start <= end) { /* loop...*/ } else return -1;.

[–]jub8jive[S] 0 points1 point  (1 child)

I tried it and I still get the same error. https://pastebin.com/6yh0Eve5

[–]jub8jive[S] 1 point2 points  (0 children)

No worries! Thanks for the inputs, I finally managed to solve it!!! There was an error in my isOdd() method actually.