Sponsored
Sponsored
Use these hints if you're stuck. Try solving on your own first.
Suppose the first digit you need is 'd'. How can you determine if it's possible to get that digit there?
Consider swapping adjacent characters to maintain relative ordering.