Short Problem Definition:
Given an array of integers, find the sum of its elements.
Link
Complexity:
time complexity is O(N)
space complexity is O(1)
Execution:
Just sum it up.
Solution:
def simpleArraySum(ar):
return sum(ar)
Coding Challenges and More
Given an array of integers, find the sum of its elements.
time complexity is O(N)
space complexity is O(1)
Just sum it up.
def simpleArraySum(ar):
return sum(ar)