JavaRush /Java Blog /Random EN /tell me the algorithm for splitting a number into digits ...
Goodwin
Level 18
Obolon

tell me the algorithm for splitting 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, 2 ^ (N-1) options are obtained, where N is the length of the number . For example 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 will not work, probably because I need to save these options.
Comments
TO VIEW ALL COMMENTS OR TO MAKE A COMMENT,
GO TO FULL VERSION