JavaRush /Java Blog /Random EN /Tell me an algorithm for dividing a number into digits in...
Goodwin
Level 18
Obolon

Tell me an algorithm for dividing a number into digits in various ways without rearranging.

Published in the Random EN group
I know that depending on the length of the number, there are 2^(N-1) options, where N is the length of the number . For example the number 1234: (then 2^(4)= 8 )
  1. [1234]
  2. [1] [2] [3] [4]
  3. [1] [2] [34]
  4. [1] [23] [4]
  5. [1] [234]
  6. [12] [3] [4]
  7. [12] [34]
  8. [123] [4]
Recursion won't work, probably because I need to store these options.
Comments
TO VIEW ALL COMMENTS OR TO MAKE A COMMENT,
GO TO FULL VERSION