Closed Lyrkan closed 5 years ago
The current compress function of the README doesn't always return the expected value:
compress
[1, 1, 2, 3, 4, 4, 4]
[1,2,3,4]
[1,2,3]
[1,1,2,3,4]
undefined
This PR changes it so:
compress([1, 1, 2, 3, 4, 4, 4])
[1, 2, 3, 4]
compress([1, 1, 2, 3, 4])
compress([1, 1])
[1]
compress([1])
compress([])
[]
thank you, sorry for the late approval
The current
compress
function of the README doesn't always return the expected value:[1, 1, 2, 3, 4, 4, 4]
) it actually output[1,2,3,4]
, not[1,2,3]
(which seems logical)[1,1,2,3,4]
the last element is missing ([1,2,3]
)undefined
This PR changes it so:
compress([1, 1, 2, 3, 4, 4, 4])
returns[1, 2, 3, 4]
compress([1, 1, 2, 3, 4])
also returns[1, 2, 3, 4]
compress([1, 1])
returns[1]
compress([1])
returns[1]
compress([])
returns[]