When the list has no exception, the first element is returned; except when numbers looks like [3,3] (bug that you can fix by adding .uniq when computing the sum.)
I believe this would fail if the outlier is even and the rest are an odd number of odd numbers. The examples all have an even number of odd numbers. Can you check that?
Bad solution! See comments below!
Ruby solution, I tried to do something different.
When the list has no exception, the first element is returned; except when
numbers
looks like[3,3]
(bug that you can fix by adding.uniq
when computing the sum.)I believe this would fail if the outlier is even and the rest are an odd number of odd numbers. The examples all have an even number of odd numbers. Can you check that?
It seems that I canβt make it right and as simple as it was. So Iβll stick with this solution: