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.
I'd like to chime in on this one. I was mislead in my initial solution assuming that x ran horizontal and y vertical, despite the picture showing the origin in the upper left. Sure I could of easily read this as a cartesian plane rotated 90 degrees, but then the navigational directions oriented with north up further lead me to think it was not rotated. Nothing in the description said otherwise. Making matters worse, the example and the first test case only use switches on points where x == y ([1,1], [4,4], etc) so there's nothing in there to tip the reader off.
So I solved it for all the example cases only to have it blow up on the real cases. It took awhile for me to figure out why, and then to refactor for the rotated coordinates.
I suggest you make it abundantly clear by labeling the coords in the picture. A second option would be to use a non=symmetrical example.
All that said, I really enjoyed working this one and the colorful description!
edge cases needed:
note: I didn't "explore" the solution suggested by Johan, so you'll have to dig on this side too
Those examples are much clearer, thanks! I was about to say if it's so hard to explain, then maybe lose the requirement :-) But then that would make it somewhat easier to solve.
updated
what the hell did I do... x/
Wait a sec
Where does that 27 come from ?!?
oh damn... let's make the "alignments" clearer (maybe...):
?
This is confusing, because that would imply sorting by the lowest highest index first. ( That's the first sequence you find completely. )
"Your code should find the sequence whose indices are lexicographically lowest" ?
It's jargony, but correct ( I think ), and the examples can clarify ( which is what they are for ).
[13,20,27]
from[17,20,13,9,27]
would give(1,2,4)
, not(0,2,3)
?woops, that's because I changed the arrays allong the way. The
</>
thing is coming from python. Might not be general enough, yes. Any help about the first §? (because the spec is there, actually x) )edit: wait... How that it's not (0,2,3)???
except it isn't
(0,2,3)
. and mixing<
and>
is confusing.Personally, I would rather focus on a correct spec than on improved examples.
mmmmh... I didn't even read that part... x) (formatting is somewhat horrible. Nobody will reach that part of the description, I guess, if you don't make it clear there is something important to grasp here).
Sooo, that would be somehting like
edit: I don't like that part:
(like for a key function comparison)
. But didn't find something better...Except in an ice hockey team then?
It might help someone see that the first index need not be
0
. I wasn't worried about that, but someone else might be. See the problem with examples?99
is Wayne Gretzky's retired number. It's ALWAYS appropriate to include :)But really, I added it just to give a case where the first index isn't 0. Good feedback that it muddies more than helps though.
But you're right, I should've said it when I saw something was failing on a sample test, but passing random tests. I just went on hastily to another kata =/
Loading more items...