0
There are repeated elements in an array.Print each element exactly once in the order given in the input array.
without using extra space. numbers are between 0 to n-1 . n is the size of array
3 Antworten
+ 2
arr= [2,4,4,3,5,5,4,4]
narr= []
for x in arr:
if x not in narr:
narr.append(x)
print(narr)
+ 1
Use print(n for n in narr) instead of print(narr)
0
u can't take extra space