Challenge 7: Find First Unique Integer in an Array
"Unique" means the number does not repeat and appears only once in the whole array. Implement the optimized solution in C# and see if it runs correctly.
We'll cover the following
Problem statement
Implement a function, findFirstUnique(int[] arr, int size)
, which takes an array and its size as input and returns the first unique integer in the array. The function returns -1
if no unique number is found.
Input
This is an array of integers and its size
Output
This is the first unique element in the array
Sample input
[2,3,9,2,3,6]
Sample output
9
Level up your interview prep. Join Educative to access 70+ hands-on prep courses.