This is, at most, a slight annoyance in the description. It is easy enough to figure out from the rest of the description and the test cases that your solution can't assume that the key length is the same as the text to encode or decode.
You misterpreted the description.
The key IS repeated throughout the message, but you don't need to make them the same length.
A little bit of modulo math.. et voíla!
Description is misleading. It says Assume the key is repeated for the length of the text, character by character.. They are not, don't assume that. YOU need to make them the same length.
just to clarify for posterity, alphabetically means based on the first or each subsequent letter.
so 1003 comes before 22 because it starts with 1 as opposed to 2 for 22.
This is, at most, a slight annoyance in the description. It is easy enough to figure out from the rest of the description and the test cases that your solution can't assume that the key length is the same as the text to encode or decode.
You misterpreted the description.
The key IS repeated throughout the message, but you don't need to make them the same length.
A little bit of modulo math.. et voíla!
This comment is hidden because it contains spoiler information about the solution
my bad, for anyone who might need this, this is th actual input for 8! (in js at least)
08>:1-:v v *_$.@ \n ^ _$>\\:^
having trouble with 8! this is the input:
08>:1-:v v *_$.@
^ _$>:^
with these insrtuctions i get the following stack:
[0,8,7,6,5,4,3,2,1]
then it starts multiplying so it turns into
[0,40320]
with the last multiplication erasing the result
[0]
is this supposed to be working differently than this?
Description is misleading. It says
Assume the key is repeated for the length of the text, character by character.
. They are not, don't assume that. YOU need to make them the same length.just to clarify for posterity, alphabetically means based on the first or each subsequent letter.
so
1003
comes before22
because it starts with1
as opposed to2
for22
.This comment is hidden because it contains spoiler information about the solution
sample test says...
but in js,
22
as a string comes before10003
as a string. Am I in the wrong here?