Outlier Number

Published by Mubashir Hassan in

Given an array of either entirely odd integers or entirely even integers except for a single Outlier Number, create a function to return this number.

Examples

outlierNumber([2, 3, 4]) ➞ 3
// 2 and 4 are even numbers.
// 3 is an outlier number.

outlierNumber([1, 2, 3]) ➞ 2

outlierNumber([4, 1, 3, 5, 9]) ➞ 4

Notes

Array size will always be >= 3.

Watch a quick demo on how Edabit works.