Ad
  • Custom User Avatar

    Done.

  • Custom User Avatar
  • Custom User Avatar
  • Custom User Avatar

    Not just corner cases, it looks like the author decided to define the question by his test cases. What happens if something outside of the test case scope is entered or desired (like possibly preventing double quotes in an address, or removing "th" from a street number like 7th -> 7). These points really should have been defined in the problem description. The ambiguity is really just turning this problem into a scavenger hunt rather than an attempt at coding.

    If I want to hunt for problem/product requirements, I'll just go into work tomorrow where I do it everyday. Why waste my time with this problem.

  • Default User Avatar

    In this case, "St." is short for "Saint".

  • Custom User Avatar

    I like my tower of DOOM numbers!

  • Custom User Avatar

    Author approve the Rust translation, please!

  • Custom User Avatar

    Big thank you for your note! Indeed, arithmetic overflow is what I should keep in mind when I do multiplication. I rewrote my solution - replaced multiplication with division and modulo operations. Seems working for extremal cases.

  • Custom User Avatar

    Note that this solution will overflow when given a prod value higher than fib(47) * fib(48), as fib(48) * fib(49) > u64::MAX. On a release build, the a * b multiplication won't panic and the while loop becomes an infinite loop.

  • Custom User Avatar

    TypeScript solution is not compiled even with a trivial body ('return 0').

  • Custom User Avatar

    Thank you! Your answer deserves to be in the description.

  • Custom User Avatar

    The rules, as stated in the kata:

    • "Dot" – is 1 time unit long.
    • "Dash" – is 3 time units long.
    • Pause between dots and dashes in a character – is 1 time unit long.
    • Pause between characters inside a word – is 3 time units long.
    • Pause between words – is 7 time units long.

    How many '1' and '0's are added per dot or dash is dependent on the sampling rate. In the example, the line is sampled exactly twice per dot.
    Hence, a dot leads to 11 instead of just 1. With a pause between characters of a word (00), we get 1100110011001100 for .... (letter H).

    Then, there is a pause for the characters inside a word which is three time units long: 000000 (6 zeros because our sampling rate is 2).
    A . (11) and another pause between characters of the same word (000000): 11000000.

    11111100110011111100111111 can be split into 111111 (), 00 (pause), 11 (.), 00 (pause), 111111 (), 00 (pause), 111111 ().
    (and so forth)

  • Custom User Avatar

    Can anybody exlain the example, how did we get 1100... from dots and dashes?

  • Custom User Avatar

    Why do you use drain(..) instead of into_iter() if you do not use the vec digits later? Why don't you use from_digit().into_iter() instead of from_digit().unwrap().to_ascii_uppercase()?

  • Default User Avatar

    u64 are not needed since all numbers of the kata fit inside i64 numbers. Moreover if I change the signature I am afraid that all already passed solutions will be invalidated.

  • Loading more items...