message: Update next-permutation.py
diff: # Space: O(1)
  class Solution(object):
  - # @param {integer[]} nums
  - # @return {void} Do not return anything, modify nums in-place instead.
  - def nextPermutation(self, num):
  + def nextPermutation(self, nums):
  + """
  + :type nums: List[int]
  + :rtype: None Do not return anything, modify nums in-place instead.
  + """
  k, l = -1, 0
  - for i in xrange(len(num) - 1):
  - if num[i] < num[i + 1]:
  + for i in reversed(xrange(len(nums)-1)):
  + if nums[i] < nums[i+1]:
  k = i
  -
  - if k == -1:
  - num.reverse()
  + break
  + else:
  + nums.reverse()
  return
  - for i in xrange(k + 1, len(num)):
  - if num[i] > num[k]:
  + for i in reversed(xrange(k+1, len(nums))):
  + if nums[i] > nums[k]:
  l = i
  + break
  + nums[k], nums[l] = nums[l], nums[k]
  + nums[k+1:] = nums[:k:-1]
  - num[k], num[l] = num[l], num[k]
  - num[k + 1:] = num[:k:-1]
  +# Time: O(n)
  +# Space: O(1)
  +class Solution2(object):
  + def nextPermutation(self, nums):
  + """
  + :type nums: List[int]
  + :rtype: None Do not return anything, modify nums in-place instead.
  + """
  + k, l = -1, 0
  + for i in xrange(len(nums)-1):
  + if nums[i] < nums[i+1]:
  + k = i
  +
  + if k == -1:
  + nums.reverse()
  + return
  +
  + for i in xrange(k+1, len(nums)):
  + if nums[i] > nums[k]:
  + l = i
  + nums[k], nums[l] = nums[l], nums[k]
  + nums[k+1:] = nums[:k:-1]
  