Coder Social home page Coder Social logo

hackerrank-algorithms-warmup-simple_array_sum's Introduction

HackerRank-Algorithms-warmup-Simple_Array_Sum

Actual Problem Question

Given an array of integers, find the sum of its elements. For example, if the array ar = [1,2,3] , 1 + 2 + 3 = 6

Input Format: The first line contains an integer,n , denoting the size of the array. The second line contains n space-separated integers representing the array's elements.

Contraints: 0 < n, ar[i] <= 1000

Output Format: Print the sum of the array's elements as a single integer.

Sample Input: 6 1 2 3 4 10 11

Sample Output: 31

Explanation:

We print the sum of the array's elements: 1 + 2 + 3 + 4 + 10 + 11 = 31

Changes in actual Question

I changed a bit in the approach. While the first line is the no of inputs i.e., numbers which we have to add. By mistaken user gives a mismatching Size at firstline or gives a wrong no of inputs in second line, we have to intimate them as "Invalid Input" or "Size Mismatched". HackerRank-Algorithms-warmup-Simple_Array_Sum.py file never shows the result until the user gives correct input i.e., the no of Inputs and length of array gets matched.

Thanks for visiting this page

hackerrank-algorithms-warmup-simple_array_sum's People

Contributors

hariprasath-ai avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.