Solución
solution.tsTypeScript
export function groupConsecutiveDuplicates(nums: number[]): number[][] {
// Escribe tu solución aquí
const output: number[][] = [];
let currentIndex = 0;
nums.forEach(num => {
if(output[currentIndex] === undefined){
output[currentIndex] = [num];
}else{
if(output[currentIndex].includes(num)){
output[currentIndex].push(num);
}else{
currentIndex++;
output[currentIndex] = [num];
}
}
})
return output;
}0respuestas