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.
To be fair, almost no tutorials teach you Big-O properly. I consistently hear of people that first learned about time and space complexity like 2-5 years after they already begun working as a developer.
For some reason this isn't taught and unless you prepare for interviews at companies like google, you likely won't hear of this early on.
I think it should be taught though, it really helps writing better code.
This is O(n^2), not great.
This kata is weird.
I used x and y coordinates to determine the destination and then used those to simply return the most optimal route.
Example:
x: -1 y: 1
would be once WEST and once NORTH.The input array was:
['EAST', 'NORTH', 'SOUTH', 'NORTH', 'WEST', 'NORTH', 'SOUTH', 'NORTH', 'SOUTH', 'WEST']
The expected answer is:
['EAST', 'NORTH', 'WEST', 'WEST']
when in reality
['NORTH', 'WEST']
would be the most optimal and time saving route.
So now I have to wonder how to get a less optimal solution to fit the weird dependencies of this kata...
Holy moly
This comment is hidden because it contains spoiler information about the solution