Skip to content

Latest commit

 

History

History

sum-and-prod

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 

Sum and Prod

https://www.hackerrank.com/challenges/np-sum-and-prod

Problem

sum The sum tool returns the sum of array elements over a given axis.
By default, the axis value is None. Therefore, it performs a sum over all the dimensions of the input array.

prod The prod tool returns the product of array elements over a given axis. By default, the axis value is None. Therefore, it performs the product over all the dimensions of the input array.

Task

You are given a 2-D array with dimensions N X M. Your task is to perform the sum tool over axis 0 and then find the product of that result.

Input Format

The first line of input contains space separated values of N and M. The next N lines contains M space separated integers.

Output Format

Compute the sum along axis 0. Then, print the product of that sum.

Sample Input 0

2 2
1 2
3 4

Sample Output 0

24

My Solution