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.
Hello everyone!
I found some strange issue while testing BasE91 encoding/decoding on the site https://www.dcode.fr/base-91-encoding.
Suppose you have aligned 13-byte input string (such length is chosen because no zero bit will be added while breaking to 13-bit blocks)
encode('1234567890123') == 'QztEml0o[2;(8YAS'
My intuition says that if you replace only one character in the input, the encoded BasE91 result will also differ only in few symbols. The results on the site supports my hypothesis:
encode('A234567890123') == 'gztEml0o[2;(8YAS'
encode('1234567_90123') == 'QztEml0o)9;(8YAS'
encode('12345678901*3') == 'QztEml0o[2;(8Y"R'
The same thing occurs if you use grave accent (backtick) symbol:
encode('1234567`90123') == 'QztEml0o[2;(8Y"R'
But if you place backtick into the second position in the input string, you'll get a wierd result:
encode('1`34567890123') == 'z"Yv$Sb%ob^heMAJ'
It also appears for longer inputs, e.g.:
encode('Baby, did you forget to take your meds?') == 'xDOfZfTXwSztI_apVR/2).&Y$F)&nuYiWPgZk>;N%y60PmcW'
Backtick is in the first place:
encode('`aby, did you forget to take your meds?') == '?DOfZfTXwSztI_apVR/2).&Y$F)&nuYiWPgZk>;N%y60PmcW'
Backtick is in the third place:
encode('Ba`y, did you forget to take your meds?') == 'xD~eZfTXwSztI_apVR/2).&Y$F)&nuYiWPgZk>;N%y60PmcW'
But the second:
encode('B`by, did you forget to take your meds?') == ')"0P6P3LYJ,WF|6U51kbiki5=Cj>TXN!509MSn_zgZe,HTOL'
It seems that BasE91 implementation on that site doesn't work properly :/
Thanks :)
In fact, after posting this solution I had devised some one-line solution
How will you check cases where x >= 50? I think this kata has simple mathematic implementation and answer can be represented as string.
Since this kata requires not to use string functions and comparisons, it's difficult to determine if warrior's code uses some of them.
Thanks, I'll keep it in mind :)