Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
A more conceptual problem: reference solution assumes that
String
is an array of bytes, which is not true. Every non-(Extended) ASCII encoding has code points outside 255. Java Strings are internally stored as UTF-16 so it definitely can store non-ASCII characters.Any appearance of such character code will cause the random tests/author solution to give an incorrect result.
If you really want to LZW compress a string, you need to encode it with a specific encoding first, which can lead to different byte values depending on the encoding.
Every test except
TOBEORNOTTOBEORTOBEORNOT
do not compress at all, so just returning the character codes will pass all the tests: see thisThis is a duplicate of https://www.codewars.com/kata/55833364a2e09a6887000166 and https://www.codewars.com/kata/584d323bca93addf92000080.
In another note, did you write your kata description with ChatGPT again? There are various telltale signs of this, such as sentences being thrown in the description that are either empty threats, or not enforced at all. Please don't do this, it makes the kata look bad.
Random test is incorrectly implemented: it breaks if the same characters appears consecutively 10 or more times.
This has been done before unfortunately: https://www.codewars.com/kata/578bf2d8daa01a4ee8000046