You are viewing a single comment's thread. Return to all comments →
Hi, I have an even simpler solution. But, I am still getting a run time error. Can anyone please help me with this. Here is my code in Python 3:
def arrayManipulation(arr, query): a, b, k = query[0], query[1], query[2] arr[a - 1 : b] = [arr[i] + k for i in range(a - 1, b)] return arr
Seems like cookies are disabled on this browser, please enable them to open this website
Array Manipulation
You are viewing a single comment's thread. Return to all comments →
Hi, I have an even simpler solution. But, I am still getting a run time error. Can anyone please help me with this. Here is my code in Python 3:
def arrayManipulation(arr, query): a, b, k = query[0], query[1], query[2] arr[a - 1 : b] = [arr[i] + k for i in range(a - 1, b)] return arr