Ad
  • Custom User Avatar

    Fixed.

  • Default User Avatar

    I think this comment just cleared up why I was failing the some of the tests! I have to finish this before the Trazadone kicks in or I'll start slurring my coding

  • Default User Avatar

    You construct the rest of the key from either the initial input string (encode) or the decoded output string (decode).

  • Default User Avatar

    It is still very unclear. Your use of the word "and" leaves multiple syntactically and semantically valid interpretations. Your test cases seem to support BOTH interpretations.
    So it could be Every (encoding and decoding) is independent, which passwordpasswordpassword -> aaaaaaaapasswordaaaaaaaa supports. If you didn't 'remember' the key from the encode, passwordpasswordpassword should be aaaaaaaaaaaaaaaaaaaaaaaa
    OR it could be Every encoding and (every) decoding is independent, which the "it's a shift cipher!" test case supports

    Does that mean that a pair of calls (encode, decode) use the same CONSTRUCTED key and then it's reset when the second function is called?

    What about encode encode?
    The encode/decode functions aren't hard to write here, but the actual expectation of the problem is poorly defined.

  • Default User Avatar

    Added the following:

    Every encoding and decoding is independent (still using the same key to begin with)

    Let me know if you think this is an improvement, meanwhile I'm marking this as resolved.

  • Default User Avatar

    I'll try to explain:-) We take by packet of at most 3; if we can take a packet of 3 "isolated" or not, we take it, if there is a packet of 1 or 2 we take them if they are, in some sense, "isolated".

    from string "0 9026315 -827&()"

    the first "0" is isolated, take it. In "9026315" we take the first packet of 3 (902) then "631" then "5" so we don't get a second "0" and we don't get 1.

    from string "Once 1000upon a midnight 110dreary, while100 I pondered, 9026315weak and weary -827&()"

    we take a first packet "100" (not "cubic") and then "0" which is cubic and the only one in the string

    from string "&z _upon 407298a --- ???ry, ww/100 I thought, 631str*ng and w===y -721&()"

    we get effectively 407 and it is the only one. The other packets of 3 are not "cubic".

    I hope that it's a bit more clear? There is no real question of "separated" or not.The only problem is to find a good regex with at most 3 digits... which is a very simple one but maybe the description is not clear enough.
    If it's not more clear, tell me, I will give you the regex:-)