fill 1 st position by every digit from 1 to 9 and calls findNDigitNumsUtil ( ) for remaining positions
for ( $ i = 1 ; $ i <= 9 ; $ i ++ ) { $ out [ 0 ] = chr ( $ i + ord ( '0' ) ) ; findNDigitNumsUtil ( $ n , $ sum - $ i , $ out , 1 ) ; } }