HackerRank ‘Simple Array Sum’ Solution

Short Problem Definition:

Given an array of integers, find the sum of its elements.

Link

Simple Array Sum

Complexity:

time complexity is O(N)

space complexity is O(1)

Execution:

Just sum it up.

Solution:
def simpleArraySum(ar):
    return sum(ar)


If you enjoyed this post, then make sure you subscribe to my Newsletter and/or Feed.

Facebooktwitterredditpinterestlinkedin