re: Daily Challenge #35 - Find the Outlier VIEW POST

FULL DISCUSSION
 

You only need to fetch the firsts 3 items to know what you are searching for.

function findOutlier (list: number[]): number | void {
  const search = list.slice(0,3).filter(v => v % 2).length > 1 ? 0 : 1;
  return list.find(v => v % 2 === search);
}
code of conduct - report abuse