Ad
  • Default User Avatar

    I don't know why it's right length, but only it's right (length of first element):

    int len = copies[0].Length;

    char[] charsResult = new char[len];

    P.S. It's very stupid, but random tests sometimes run on wrong decisions (if you press the button several times).

  • Default User Avatar

    I wasn't able to place a fork for some reason, but I made this solution a bit more readable, you see it under my solution.

  • Custom User Avatar

    The only thing wrong is that the minimum tick does not occur in corner-case messages where every word is a 'T' (-), since 'T T T' --> '- - -' --> '11100000001110000000111'; but the tick (1 in this case) is recoverable.

  • Custom User Avatar

    5 replace() calls + an initial regex pass makes this not that elegant, the solution should only need to iterate through bits twice at most

  • Custom User Avatar

    It's curious how 14 people all have this exact same solution, down to the whitespace and the wording of the comments.

  • Default User Avatar

    Actually this can't be the case. If the sample rate would be 3 bit per character there is no way to have 7 '0' in a row. With 3 bit per character there can only be '0' strings of length 3 (between dots and dashes), 33=9 (between characters) and 37=21 (between words).

    Because of this the bits per character must be 1, as this is the only way we can get '111' and '0000000' at the same time

    Yes there need to be at least one zero between each dot and dash, but with '1110000000111' we only have 2 dashes, each building a word of 1 character.

    '1110000000111' -> '- -' -> 'T T'

    We would need to have '111000111' in order to get '..' -> 'I'

    '111000000000111' would lead to '. .' -> 'E E'