Ad
  • Default User Avatar

    @alexandersmanning said it totally right...furthermore in this thing look for your loop condition..you don't need to loop it for n..1 just half n/2..1 is enough for the solution. I hope this will help you out.

  • Default User Avatar

    Great solution.......i liked it.
    more on we can use collect rather use map second time like:

    nums = numbers.split.map(&:to_i).collect {|x| x.even?}

    Thanks you....!!

  • Default User Avatar

    There must be a condition on very first part to check if n is non-zero or not. if non-zero then return it from there no need to go inside with non-zero.
    Without this code is fine but seems applying condition would be appropriate THINK!!!!!!!!!!