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.
This comment is hidden because it contains spoiler information about the solution
Fun kata, and really not as difficult as it sounds.
I can confirm there is no ambiguity with the description, and no problems with any of the test tracks.
How are you counting 157 and 298? You can verify the 147 and 288 just by counting the characters manually. Yes the corner and cross count.
Remember that the distance given is always the number of clockwise steps to the train engine (upper case), even if the train itself moves anti-clockwise.
I thought this was too easy for a 2ku.. until my solution timed out.
This seems clear enough. It works the way things would work in real life.
This comment is hidden because it contains spoiler information about the solution
Then if you had a very short message such as "A"(.-) or "I"(..) how can it be possible to discriminate between these two messages, when a . and - can be almost exactly the same length??
Thanks for the explanation in comments. I had trouble understanding the other solutions on here.
Oops, forgot to free(map)
Does codewars give us some way to compare execution times?
I did. After a few clicks it passed enough test to submit.
I found your solution the easiest to understand.
Copied from the test output:
Testing for
a = 86145488817072043383884003863510347105989906101641249662970241577287787698508874999177364508656576274935706885286393141593679228865551053832372931467538995019025892197
b = 68283205531307688650940110
The expression (as strings) (*actual) == (*expected) is false:
actual=
1261591165013109116338669484556670101213578040400519716268764684027583190428812603036885921813379848491415374057859218155797785943219562965336
expected=
1261591165013109116338669484556670101213578040400519716268764684027583190428812603036880984013379848491415374057859218155797785943219562965336
.When compiled and run with "gcc (Debian 8.3.0-6) 8.3.0" my solution does NOT produce the above 'actual' ouput. It DOES produce the expected output.
This (and many other solutions here), will break if given a string of length 0 ("")
This comment is hidden because it contains spoiler information about the solution