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.
Prolog translation
Unless I'm misunderstanding something the test cases aren't sufficient here for all edge cases. You say the final array should be sorted regardless of the order in the input array. But there is no test case that really checks this. For example my code passes all your tests but it doesn't work if I pass in this array [2,3,4,1]. This input will return this answer [[2, 4], [1, 3]] which is not sorted. But my code passes the kata no problem. Also your random test cases are always sorted in ascending order so those will never catch it either.
D translation
PHP translation, please evaluate