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.
im amazed by these one line solutions!
nicely done.
Oh, I got it now. You were right, I was couting rows and columns (row 0, row 1..., column 0, column 1). Thanks so much!
0, 0 is top left, that's an
a
with x-axis being right-left, that means
@
is two steps right, so x-axis is 2, and it's one down, so y-axis is 1:(x, y)
(2, 1)
I.. don't see how you're getting
(1, 2)
for@
if (1,2) is x,y, then you changed the x coordinate but said you're going up, which is vertical(up/down) movement, but you said x is horizontal(left/right)
.. no clue where we're viewing this differently x)
I explained bad myself, I think. Not talking of writting the grid but the position you should step. I mean, in the first example the first position (the starting "@") should be (1,2) (x,y), and the first step in order to go to the key is going up to (0,2), right? So when you say the array that should be returned with the pair x-y steps, you said "[(2, 1), (2, 0)...", there is where I am lost. Sorry for my clumsy english, I am explaining myself as hell...
Do you mean that you're writing
grid[x][y]
? That would be you swapping them, since grid contains rows, not columns.avoiding the variable names x and y may help. try row and col. and you should always consider re-structuring any input data you receive to suit you.
Hello, sorry for the dumb-newbie question but I don't understand the first example. I mean, I suppose isn't wrong 'cause have been tested and achieved so some of them will pointed to it of ot were the case, but, "x" and "y" seems to be swapped to me. If "x" is for horizontal and "y" is for vertical: won't be "@" (1, 2) and first step to (0, 2), then (0, 1) and so on? Thanks.
Wow
Hi, I think you have the sample tests and the actual tests swapped around
genius
very cool bro
Copy that. Thank you!
not usually best practice, in real life strive for readibility while being able to make your code shorter
I keep forgetting I don't need to make new variables for everything and it can all usually fit inside a return statement. Unsure at my level if that is the best practice, but the fewer lines of code is what I'm currently striving for as I learn.
please do acknowledge that the compile time is much higher than the for-loop approach...
my for-loop approach:
Execution time: 0.0000375 seconds
regex approach:
Execution time: 0.0007297 seconds
Integer division.
Loading more items...