When N is 1 and K > 0 , then the single number will be the first and last digit it cannot have difference greater than 0
if ( N == 1 and K == 0 ) : NEW_LINE INDENT result . append ( 0 ) NEW_LINE DEDENT elif ( N == 1 and K > 0 ) : NEW_LINE INDENT return result NEW_LINE DEDENT