Empresa engajada
Consider an array of integers, which are sequenced, such as [1,2,3,5,8,12,13,14,15]. Please write the function which returns a comprehensible string, for example [1-3,5,8,12-15].
Sigiloso
Use stack, create interval in the stack top. If the new element is only +1 larger than the top, change the last element of the top to the new element, otherwise pop the top element of stack, add the poped interval into the output array.