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.
Nice solution! As I was trying to wrap my head around it though, it seems to hit the stack size limit on node 0.12.1 for the last test case, the 5x5 map.
Output:
I like that you added the decoded string to the key itself. I kept the decoded string in a separate string so I could access it within the map/forEach. This is a much better approach. Nicely done!
Makes sense. Thanks @surtich!
I don't understand how the pair [3, 7] is earlier in this example:
If the 5 occurs at index 1, why isn't it "earlier" than the 3 at index 3? Aren't we reading from the left?
The description states that "redo is only possible after an undo". I interpret that to mean that Redo will only work when the immediate last action was an undo. For example, if I do set(), undo(), and then redo(), my last action is a redo(), and so I should not be able to redo(), since my last action is not an undo().
If that's correct, then why do I see in the provided test cases the following:
Shouldn't this throw an exception?
Yeah, plus creating a copy of the array costs memory and cycles.
TIL you can have multiple declarations separated by comma in a for loop expression (e.g.
i++, j--;
). Neat!