Challenge: Find First Unique Integer in an Array
Given an array, find the first integer, which is unique in the array. Unique means the number does not repeat and appears only once in the whole array. Implement your solution in JavaScript and see if it runs correctly!
We'll cover the following
Problem Statement
Implement a function, findFirstUnique(arr)
, which takes an array as input and returns the first unique integer in the array.
Here you will use your knowledge of Hash Tables to write another solution of this challenge.
Note: The function should return
null
if no unique number is found.
Input
An array of integers
Output
The first unique element in the array
Sample Input
[9,2,3,2,6,6]
Sample Output
9
Level up your interview prep. Join Educative to access 70+ hands-on prep courses.