Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
Done.
alley
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.
In this case, "St." is short for "Saint".
I like my tower of
DOOMnumbers!Author approve the Rust translation, please!
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.
Note that this solution will overflow when given a
prod
value higher thanfib(47) * fib(48)
, asfib(48) * fib(49) > u64::MAX
. On a release build, thea * b
multiplication won't panic and the while loop becomes an infinite loop.TypeScript solution is not compiled even with a trivial body ('return 0').
Thank you! Your answer deserves to be in the description.
The rules, as stated in the kata:
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 just1
. With a pause between characters of a word (00
), we get1100110011001100
for....
(letterH
).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 into111111
(–
),00
(pause),11
(.
),00
(pause),111111
(–
),00
(pause),111111
(–
).(and so forth)
Can anybody exlain the example, how did we get 1100... from dots and dashes?
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()?
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...