Count number of ways to cover a distance | Returns count of ways to cover 'dist ; Base cases ; Recur for all previous 3 and add the results ; Driver code
' NEW_LINE def printCountRec ( dist ) : NEW_LINE INDENT if dist < 0 : NEW_LINE INDENT return 0 NEW_LINE DEDENT if dist == 0 : NEW_LINE INDENT return 1 NEW_LINE DEDENT return ( printCountRec ( dist - 1 ) + printCountRec ( dist - 2 ) + printCountRec ( dist - 3 ) ) NEW_LINE DEDENT dist = 4 NEW_LINE print ( printCountRec ( dist ) ) NEW_LINE