Closed SS-JIA closed 7 years ago
Hi @SS-JIA, interesting question, I can see how this can be interpreted either way--it's helpful to clarify these things up front before diving into a solution.
I think I'd prefer to keep the current set of test cases as-is for this problem's interpretation of the constraints. Thanks!
In compress_challenge, the problem is specified as:
Problem: Compress a string such that 'AAABCCDDDD' becomes 'A3BC2D4'. Only compress the string if it saves space.
However, the last three test cases test for:
assert_equal(func('AAABCCDDDDE'), 'A3BC2D4E') assert_equal(func('BAAACCDDDD'), 'BA3C2D4') assert_equal(func('AAABAACCDDDD'), 'A3BA2C2D4')
shouldn't they be:
assert_equal(func('AAABCCDDDDE'), 'A3BCCD4E') assert_equal(func('BAAACCDDDD'), 'BA3CCD4') assert_equal(func('AAABAACCDDDD'), 'A3BAACCD4')
since compressing 2 repeated characters doesn't save space?