<s> """<STR_LIT>""" <EOL> __author__ = '<STR_LIT>' <EOL> class Solution : <EOL> def previousPermuation ( self , num ) : <EOL> """<STR_LIT>""" <EOL> n = len ( num ) <EOL> partition = n - <NUM_LIT:2> <EOL> while partition >= <NUM_LIT:0> and num [ partition ] <= num [ partition + <NUM_LIT:1> ] : <EOL> partition -= <NUM_LIT:1> <EOL> if partition < <NUM_LIT:0> : <EOL> return num [ : : - <NUM_LIT:1> ] <EOL> change = n - <NUM_LIT:1> <EOL> while change >= <NUM_LIT:0> and num [ change ] >= num [ partition ] : <EOL> change -= <NUM_LIT:1> <EOL> num [ partition ] , num [ change ] = num [ change ] , num [ partition ] <EOL> num [ partition + <NUM_LIT:1> : ] = reversed ( num [ partition + <NUM_LIT:1> : ] ) <EOL> return num <EOL> if __name__ == "<STR_LIT:__main__>" : <EOL> print Solution ( ) . previousPermuation ( [ <NUM_LIT:1> , <NUM_LIT:3> , <NUM_LIT:2> , <NUM_LIT:3> ] ) </s>
