0
How to remove duplicate number from sorted list?
sorting
2 ответов
0
i think the easiest way to do it would be create another list in which you add one by one the numbers, if you find that after a 3 there is another 3, you do nothing so the next number (the second 3) you can redo the control and eventually add it to the second list
Example (pseudolanguage)
list1=[1,2,3,3,3,5];
k=0;
for(i=0; i<len(list1); i++){
if(list1[i]!=list[i+1]){
list2[k]=list1[i]
k++;
}else{
}
}
otherwise in languages such as python (i know in this one) sets exists, they don't allow duplicates
https://code.sololearn.com/ch4cXq7DQvwj/?ref=app
0
thx bro