Look, ‘|’ is the partition. It counts number of x’s left/right to it or in between 2 ‘|’.
002 -> ||xx
Left most is ‘|’ hence left most digit is 0 because there are no x’s left of it.
After ‘|’ is another ‘|’, hence no x in between hence 0
After this |, we have 2 x’s hence 2.
Similarly, |xx||xxx would be 0203.
Leftmost is a ‘|’ hence leftmost number is 0. After this before the next ‘|’, we encounter 2 x’s hence 2. Then we have no x’s, before next ‘|’ hence 0. And finally to the right of it there are 3 x’s hence 3 at the rightmost number.
So, for M numbers we would have (M-1) ‘|’. OK?