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.
There is a minor corner case
you want to choose the bigger right end point when merging, otherwise [1, 5, 2, 3] would give [1, 3].
I have updated the test case. But apart from this, Elegent solution!!
digit_count is better name for count_digit. Because it returns something. (instean of doing something with side effect)
I like the do-while loop, I used a extra if to deal with the corner case n=0, d=0.
This comment is hidden because it contains spoiler information about the solution