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.

  • Custom User Avatar

    this solution will fail on ['SOUTH', 'SOUTH']

  • Custom User Avatar

    I tried this code in MSVS 2013 .NET 4.5 - works fine.

  • Custom User Avatar

    Thanks, you should add such explanation to the details.

  • 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:-)

  • Custom User Avatar

    Test cases contradict each other! I can't get solution to work!

    Why from string "0 9026315 -827&()" we sohuld get 0, but not 0 0 1 ? // So, I assumed, numbers should be separated
    Why from string "Once 1000upon a midnight 110dreary, while100 I pondered, 9026315weak and weary -827&()" we should get 0? // 0 is not separated from other digits and is not unique in string
    Why from string "&z _upon 407298a --- ???ry, ww/100 I thought, 631str*ng and w===y -721&()" we should get 407? // 407 is not separated from other digits

  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Custom User Avatar

    The Haskell test suite does not enforce the correctness for n > 254 case, so I accidentally submitted an incorrect solution and it got accepted.

  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Custom User Avatar

    C# Submit tests validated my first and second erroneous solutions.

  • Loading more items...