Ruby - The integers in the array are either entirely odd or entirely even except for a single integer : You are given an array (which will have a length of at least 3, but could be very large) containing integers.

The array is either entirely comprised of odd integers or entirely comprised of even integers except for a single integer N.

Write a method that takes the array as an argument and returns this “outlier” N.

My code so far, that doesn't seem to work:

<!-- begin snippet: js hide: false console: true babel: false -->

<!-- language: lang-html -->


    arr = [160, 3, 1719, 19, 11, 13, -21]
    n = arr.length

    def getOddOccurrence(arr, arr_size)
      for i in range(0, arr_size)
        count = 0
        for j in range(0, arr_size)
          if arr[i] == arr[j]
            count +=1
          end
          if(count % 2 != 0)
            return arr[i]
          end
        end
      end
      return -1
    end

    print getOddOccurrence(arr,n)

<!-- end snippet -->

What do I need to change with this code please?
