27 lines
485 B
Python
27 lines
485 B
Python
def removeDup(a):
|
|
i=0
|
|
while i < len(a) - 1:
|
|
if a[i] == a[i + 1]:
|
|
a.pop(i)
|
|
else:
|
|
i += 1
|
|
|
|
|
|
def sameElements(a, b):
|
|
cpa = sorted(a)
|
|
cpb = sorted(b)
|
|
|
|
if len(cpa) == len(cpb):
|
|
i=0
|
|
while i < len(cpa):
|
|
if cpa[i] != cpb[i]:
|
|
break
|
|
|
|
i += 1
|
|
|
|
if i == len(cpa):
|
|
return True
|
|
|
|
return False
|
|
|
|
print(sameElements([1,5,2,4,8], [1,4,2,8,5])) |