Skip to content

Instantly share code, notes, and snippets.

def randomMod(A, B, X1, K, M):
if K == 0 or M == 0:
print 'Input Error'
return
addAux = aux(A, K, B)
output = [0,0,0,0,0]
output[0] = (A**(K-1))*X1 + addAux
class Solution:
# @param num, a list of integer
# @return a list of integer
def nextPermutation(self, num):
n = len(num)
k = -1
l = -1
# Find the largest k such that num[k] < num[k + 1]
for i in range(n - 1):
if num[i] < num[i + 1]:
class Solution:
# @param A, a list of integers
# @return an integer
def maxSubArray(self, A):
ThisSum = 0
MaxSum = -10000
for i in range(0, len(A)):
if ThisSum < 0:
ThisSum = 0