-
-
Notifications
You must be signed in to change notification settings - Fork 556
Incomplete specification for run-length encoding? #238
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
The thought also occurred to me but I assumed it was intentional. I'd imagine we could run into some interesting problems with the metadata otherwise as different languages may have preferred ways to handle this (multidimensional arrays vs tuples vs escapes in strings, etc.) |
Really any choice is fine, as long is it's specified. That said, I'm not keen on not allowing numbers given that the code explicitly handles unicode characters. The simplest solution would be to also prefix single character sequences with a count of 1. That does tend to defeat the optimization in most practical applications, however. |
Wouldn't including 1s still not solve the problem of numbers? As per your example: |
Yes you are completely right. I missed that. |
I think adding 1s (always the count) and limiting it to max chunks of 9 would solve the problem, because you would get a clear pattern of count/character. So There are already 9 tracks that implemented this exercise without 1s, so maybe the easier way would be to change the readme instead of all the implementations. |
I think that in order to keep the exercise simple, it would be better to not include numbers. Explicitly mentioning that it only needs to handle letters in the Readme is probably a good idea. Here is the description.md |
Unless I'm mistaken, the tests for the run-length encoding problem don't account for numerical data. Single character sequences are not prefixed with a number and runs of characters are not prefixed with an escape flag. This leads to ambiguity when dealing with strings like these:
22333
, which encodes to22333
, but what should it decode to:22333
or(2233 * 3)
or2(23 * 3)
or one of the other possibilities?The text was updated successfully, but these errors were encountered: