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.
Hmm, I don't understand this...
Anyone knows why my code ends with a "choicepoint" as a warning given by the test runner?
I thought that:
financeAcc(A, A, _, Acc, Acc).
Would make the recursion stop because it implies A, A is the same, when Idx and N reaches the same number.
I'm not sure about different ranks for different languages and the same problem.
Isn't it a case of logical solution, and use the tools that the language provides?
It's just that I don't see how it should be harder in different languages, i might need to implement some more things, but the logic would be similar.
Just my opinion though :)
He just used high level functions for the purpose of this kata, with a simple algorithm in mind:
1: Get first line in order (left to right), using shift on the matrix you get the first line.
2: Last column in order (top to bottom), using map in the matrix, poping the last elements from every line.
3: Last line reversed (right to left), using pop in the matrix you get the last array, and then reverse it (because of the snail logic).
4: first column reversed (bottom to up), you again go through the entire matrix (using map) getting the first element (using shift) of each array, and then reverse it, since the other elements are being removed it works.
Do it all over again until there is no more items.
Hope it's clear enough.
Well, it might be slower. But I think that for the purpose of his application it's good enough.
You can always spend more time trying to optimize things, but I think that in this case it is way clearer than to work with lots of indexes, increments or whatever (which was my case).
The simple use of high level functions with his simple algorithm in mind is enough until more performance is actually needed.
Not saying that measuring and comparing performance is not valid at all though.
I guess that he meant that it is the max value that can be represented with the given caracters of the problem statement.
You don't have characters to represent 5000 unit or more, in order to represent 4000 with roman numeral logic.
I think that since it's a simple validation of "tokens", it's a valid approach for this kind of problem.
Also looking at another solutions (including mine), I wouldn't be so sure that those are clearer.