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.
what is this even doing?
wtf
I really like the structure and very easy to read
for shure its new Function, not the same))))
Really nice practice PogU
Very interesting and creativ approach.
But i think the performance is the same as just looping through the array once, counting the appearances for each orientation and at the end check, if
n==s && e==w
. And i think the approach i mentioned is way easier to understand and also to maintain.Edit: I think the solution i mendioned is even a fraction better on performance, but it's really more about readability and maintainability.
This is genius.
I hate to rant, but I don't think this should really be considered "best practices". Maybe it takes the fewest cycles to compute, but getting the answer either because you derived the series math or looked up tetrahedral numbers on wikipedia doesn't seem to follow in the same vein.
Maybe I'm confused as to what "best practices" really refers to, but I would imagine this exercise is meant to teach the user about loops (and recusion too, I would think, but that is ruled out by one of the test cases), and therefore I think "best practices" should refer to solutions that exemplify the intended lesson. Taking a shortcut removes much of the intended learning process.
Can anyone explain why this works?