What's the best code to complete this function:
Input: a = [5,5,5,5,5,3,3,3,4,4,4,4,3,3,3,2,2]
Output: b= [5,3,4,3,2]
Notice 5 repeats 5 times in a row and then 3, 3 times in a row etc. Output must have the repeats, ie 3 comes up twice, and must be in order that numbers come in the input.
Best of luck!
Aucun commentaire:
Enregistrer un commentaire