Find duplicate

Given an array of n integers with duplicate, output unique numbers of the array.

Hint

Create an empty list to store the unique items. Go through each item in the original list, and check if the item is already in the unique items list. If it's not, add it to the unique items list. Return the unique items list.

# Python implementation
ls = [1, 2, 3, 3, 5, 7, 7, 8, 1]
output = []

for item in ls:
  if item not in output:
    output.append(item)

print(output)
// Javascript implementation
const list = [1, 2, 3, 3, 5, 7, 7, 8, 1];
const output = [];

for (let item of list) {
  if (!output.includes(item)) {
    output.push(item);
  }
}

console.log(output);