Ad
  • Custom User Avatar

    Pardon me, You're correct.

  • Default User Avatar
                       1234567890123
    ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ ?
         3210987654321
    
  • Custom User Avatar

    There is something wrong with the test cases that include 's' or 'S'.
    's', after 13 positions shift, should equal 'h' instead of 'f'.
    Analogously, 'S' should equal 'H' instead of 'F'.

  • Custom User Avatar
  • Custom User Avatar

    There is no more effective way to solve this problem. At the very least, you would need to travese the string which takes O(N). For extra space complexity, the variable crypt to store each key-value pair has O(1) space complexity since its size is not dependent on the size of the input string. If not consdiering the output string to be returned, the space complexity would be O(1) as well.

  • Default 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

  • Default User Avatar

    you keep incrementing the str pointer. When you return it, it is pointing to the nul-terminator, so it's effectively an empty string. Also, you overflow the char datatype by adding 13 to the last ASCII letters (e.g. 'z' + 13)

  • Custom User Avatar

    "The one you linked is deciphering it, this one is encoding it, they're not the same."

    ...yes they are?
    eg:

    decode: "ABCD" -> "NOPQ"
    encode: "ABCD" -> "NOPQ"
    

    The encode function is exactly the same as the decode one..

  • Custom User Avatar

    It is already specified how they should be handled in description.

    If there are numbers or special characters included in the string, they should be returned as they are

  • Custom User Avatar

    Anyone reading, feel free to continue discussing, but since this has nothing to do with improving the kata I'm marking this as resolved.

  • Custom User Avatar

    You are not able to nest functions?

  • Default User Avatar

    it's no longer there

  • Custom User Avatar

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

  • Default User Avatar

    You are correct. I just messed the registers up. Have a nice day.

  • Loading more items...