<s> class Solution : <EOL> def permute ( self , num ) : <EOL> result = [ ] <EOL> used = [ False ] * len ( num ) <EOL> self . permuteRecu ( result , used , [ ] , num ) <EOL> return result <EOL> def permuteRecu ( self , result , used , cur , num ) : <EOL> if len ( cur ) == len ( num ) : <EOL> result . append ( cur + [ ] ) <EOL> return <EOL> for i in xrange ( len ( num ) ) : <EOL> if not used [ i ] : <EOL> used [ i ] = True <EOL> cur . append ( num [ i ] ) <EOL> self . permuteRecu ( result , used , cur , num ) <EOL> cur . pop ( ) <EOL> used [ i ] = False <EOL> if __name__ == "<STR_LIT:__main__>" : <EOL> print Solution ( ) . permute ( [ <NUM_LIT:1> , <NUM_LIT:2> , <NUM_LIT:3> ] ) </s>
