/* Create a function that takes an array of numbers and return the number * that's unique. */ // a a a a b -> abaaa returns '2' // c d d d d d -> cddddd returns '2' double unique(std::vector arr) { std::sort (arr.begin(),arr.end()); std::unique (arr.begin(),arr.end()); // expression ? trueValue : falseValue return arr[1]!=arr[2] ? arr[1] : arr[0]; }