CtCI-6th-Edition-JavaScript-ES2015 icon indicating copy to clipboard operation
CtCI-6th-Edition-JavaScript-ES2015 copied to clipboard

1.6 String Compression is incorrect

Open booboothefool opened this issue 7 years ago • 0 comments

compressString('aabcccccaaa') => '2a1b5c3a'

should be a2b1c5a3

Just have to change: cStr += (i - start + 1) + char; to cStr += char + (i - start + 1);

booboothefool avatar May 16 '17 00:05 booboothefool