Hello…, let’s find how how we can find the unique element from an array from an unsorted array which has duplicate values –
let’s initialize an array –
let a = [1,2,2,3,4,1,5,6,6,7]
and create a variable and initialize it with a[0] value –
let r = a[0]
now the main part, to iterate through array and find out the element with no duplicate value without creating any data structure and in single for loop –
for(let i=0; i
here is the complete code at one -
let a = [1,2,2,3,4,1,5,6,6,7]
let r = a[0]
for(let i=0; i
Hope it helped you and you found it valuable.