This is the key line in this method . Note that all recursive / calls have a separate copy of num , but they all share same copy of dupNum . We divide num while moving up the recursion tree
if ( not isPalUtil ( int ( num / 10 ) , dupNum ) ) : NEW_LINE INDENT return False ; NEW_LINE DEDENT