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.
The problem is with your current algorithm. Consider what would happen if you got the input: 90000000000000001? It should be pretty clear that the next smaller with the same digits is 19000000000000000, yet if your algorithm starts by counting backward from 90000000000000001 all the way down, it will timeout long before reaching the correct answer.
Think about writing an algorithm that transforms the input rather than one that brute-forces a counter and checks if the result has the same-digits.
Good luck!