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.
Nested loop alters the outer loop counter so it 'fasts forward', it therefore does not cause combinatorial wasted effort.
Your code has ~4 extra conditionals so is unlikely to perform any better.
Есть несколько советов:
too many loops when one-loop aproach is possible here^^
Please, avoid recursion if possible and in this task it is possible ^^ (loop inside loop too)
Please, try to avoid loop inside loop if possible and in this task it is possible^)
This comment is hidden because it contains spoiler information about the solution
That is deliberate. It means the index matches the dice value. More readable IMO. YMMV.
no reason to use
trim()
as methodcapitalize()
will return empty string in result if input is emptyand
trim()
Also try to avoid switchcase statement.
actualy u dont use one of the cell of n[] array is n[0]. In this case u can use int[6] and in cycle use n[d-1]++