donnemartin / interactive-coding-challenges

120+ interactive Python coding interview challenges (algorithms and data structures). Includes Anki flashcards.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Arrays_Strings compress challenge tests inconsistent

alpertoygar opened this issue · comments

In the chellenge compress there are tests:

assert_equal(func(None), None)
        assert_equal(func(''), '')
        assert_equal(func('AABBCC'), 'AABBCC')
        assert_equal(func('AAABCCDDDDE'), 'A3BC2D4E')
        assert_equal(func('BAAACCDDDD'), 'BA3C2D4')
        assert_equal(func('AAABAACCDDDD'), 'A3BA2C2D4')

The question states compress only if saves space but while a test is not changing the 2 consecutive letters as seen:

assert_equal(func('AABBCC'), 'AABBCC')

While the other exemples such as this one:

assert_equal(func('AAABCCDDDDE'), 'A3BC2D4E')

compresses it.

If this is not intended and if I'm not terribly wrong 😄 then some of the tests must be changed.

I would kindly offer my help to change them and open a PR if you would kindly point which ones need change (again if I'm correct)

Sorry there was a better one