Say I have a list (not necessarily sorted):
lst = [1, 1, 1, 2, 3, 4, 5, 6, 7, 8, 8, 9, 9, 10, 10, 10]
I need a function that returns count of unique elements in a list, in this case 10
.
I am not allowed to use dict
or set
.
I thought about doing something like:
num = len(lst)
for e in lst:
for i in lst:
if e == i:
num -= 1
But clearly, it does not work. Thanks!