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.
Well though I have to admit that you're right but in general I love it. Why? It opened my eyes and shaked my mindset. I'd like to say to some degree it was a seminal solution though with some bugs but still worthy.
The worst case is with all
p[i][x]
equal to each other, which gives N^2 (N(N-1)/2 distance calculations). It appears the average complexity is logarithmic though, which is pretty cool!the order of your zeros is wrong. for example, if we have the input array [1,2,"0",4,4,0,1,4,"0",2] then the output should be [1,2,4,4,1,4,2,"0",0,"0"]. If the zeros in the back are in any other order, it doesn't work. For example the output [1,2,4,4,1,4,2,0,"0","0"] would be wrong.