Finding the number in a list that differs in parity
Well, one way we can do it is by counting the first three elements. If more than one is odd, it means the sequence is odd, and we should look for an even number. If one or less is odd, the sequence is even, and we should look for an odd number.

a1 = "2 4 6 7 8 10"
a2 = "3 5 7 9 10"

def index_of_outlier(string)
  array = string.split(' ').map(&amp;:to_i)
  count_of_odd = (array[0..2]).count { |i| i.odd? }
  if count_of_odd &gt; 1
    array.index { |i| i.even? }
  else
    array.index { |i| i.odd? }
  end
end

puts index_of_outlier(a1) #=&gt; 3 
puts index_of_outlier(a2) #=&gt; 4


This looks messy, but it gets the job done quickly. The lower bound is \$3 + 1\$ iterations, and the upper bound is \$3 + n - 1\$. This makes it \$O(n)\$.

You need three iterations to determine the nature of the sequence and up to \$n - 1\$ more to find the solution.

I'm not sure how partition works under the hood, but I assume it traverses the array at least once. This means my solution will perform better if the target index is lower than \$n - 5\$.

If you want the char position in the string and not the array index, just add one to the result (as you are doing in your own solutions).