Some programming treats look nicer to me, one of them is determining whether a series of numbers is ordered in one way or another.
It can come useful when trying to decipher some shuffled data set, which mainly strikes me on Kaggle. Albeit with a little flaw it could be done 'on the spot', i.e. trivial solutions are easy to implement, it seems like an interesting exercise if vectorization is a requirement.
And I'm trying to collect such things here and keep my brain moving, so I created a solution which I'll give below.
The function
Not much (just at a proof of concept level), but tested: link to the test code.
Obviously if anyone has a better idea for the implementation, please give me a shout!
No comments:
Post a Comment