/** * @param {string} s * @return {number[][]} */ var largeGroupPositions = function(s) { var result = []; var start = 0; var end = 1; while(s[end]){ while(s[end] == s[start]){ end++ } if(end - start >=3){ result.push([start,end-1]) } start = end; end = start + 1; } return result; };