wes d2a2ba9e15 first commit 4 éve
..
README.md d2a2ba9e15 first commit 4 éve
code.cpp d2a2ba9e15 first commit 4 éve
unitTest.cpp d2a2ba9e15 first commit 4 éve

README.md

Which Number Is Not like the Others?

by Helen Yu tags: numbers, arrays, algorithms

Summary

Create a function that takes an array of numbers and return the number that's unique. Examples unique([3, 3, 3, 7, 3, 3]) ➞ 7 unique([0, 0, 0.77, 0, 0]) ➞ 0.77 unique([0, 1, 1, 1, 1, 1, 1, 1]) ➞ 0 Notes Test cases will always have exactly one unique number while all others are the same.

Instructions

Create a function that takes an array of numbers and return the number that's unique.

Examples

unique([3, 3, 3, 7, 3, 3]) ➞ 7

unique([0, 0, 0.77, 0, 0]) ➞ 0.77

unique([0, 1, 1, 1, 1, 1, 1, 1]) ➞ 0

Notes

Test cases will always have exactly one unique number while all others are the same.