Ad
Code
Diff
  • function kumite(arr) {
        var copy = [...arr];
        for(var i=0; i<copy.length-1; i++){
            if(copy[i] == copy[i+1]){
                for(var j=i+1; copy[j] == copy[i]; j++);
                copy.splice(i, j-i);
                i--;
            }
        }
        return copy;
    }
    • function kumite(arr) {
    • return [];
    • var copy = [...arr];
    • for(var i=0; i<copy.length-1; i++){
    • if(copy[i] == copy[i+1]){
    • for(var j=i+1; copy[j] == copy[i]; j++);
    • copy.splice(i, j-i);
    • i--;
    • }
    • }
    • return copy;
    • }