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.
Please, add details on the assumptions about the input array such as it containing only positive integers, without repetition, or add some tests.
Also precise input array could be large.
I agree, some solutions return
1
for[2, 2, 2]
...Maybe you could prevent usage of some Array functions by redefining them ?
Also I was not sure from description if we could or not use at least some functions like
concat
which seems quite inevitable...const sortedDigits = n => { let arr = n.toString().split(''); arr.sort((a, b) => b - a); return arr; };
could be
const sortedDigits = n => n.toString().split('').sort((a, b) => b - a);