def delete_dupl(list):
deleted = {}
# add each element to a map
for item in list:
deleted[item] = 1
# clear list to replace with the shortened one
list.clear()
for key in deleted:
list.append(key)
return deleted
print(delete_dupl(<given_list>))
There's probably a better way but adding each item to a map (dict) is enough, as there can't be repeated keys; then pass every key to an array.
This is how I'd do it in Python:
There's probably a better way but adding each item to a map (dict) is enough, as there can't be repeated keys; then pass every key to an array.
Ok..
I don't speak python for now. Am a newbie in JavaScript trying to work on that task.
Thanks for your response...👍
Well, I'm not fluent on JS either but I don't think they're so different at tackling this problem :)