<garvit244>31_1.py
def nextPermutation( nums):
    index_i = len(nums) - 2
    while index_i >= 0 and nums[index_i] >= nums[index_i+1]:
        index_i -= 1
    
    if index_i >= 0:
        index_j = len(nums) - 1
        while index_j >= index_i and nums[index_j] <= nums[index_i]:
            index_j -= 1
    
        nums[index_i], nums[index_j] = nums[index_j], nums[index_i]
        
    start = index_i + 1
    end = len(nums) - 1
        
    while start < end:
        nums[start], nums[end] = nums[end], nums[start]
        start += 1
        end -= 1
def sample_funcname ( var_0 ) :
    var_3 = len ( var_0 ) - 2
    while var_3 >= 0 and var_0 [ var_3 ] >= var_0 [ var_3 + 1 ] :
        var_3 -= 1
    if var_3 >= 0 :
        var_6 = len ( var_0 ) - 1
        while var_6 >= var_3 and var_0 [ var_6 ] <= var_0 [ var_3 ] :
            var_6 -= 1
        var_0 [ var_3 ] , var_0 [ var_6 ] = var_0 [ var_6 ] , var_0 [ var_3 ]
    var_7 = var_3 + 1
    var_8 = len ( var_0 ) - 1
    while var_7 < var_8 :
        var_0 [ var_7 ] , var_0 [ var_8 ] = var_0 [ var_8 ] , var_0 [ var_7 ]
        var_7 += 1
        var_8 -= 1
