A Very Big Sum

Sort by

recency

|

2018 Discussions

|

  • + 0 comments

    I found solving in Javascript

    let sum = 0; for (let i = 0; i < ar.length; i++) { sum = sum + ar[i]; } return sum;

    You can also use reduce() for the simple way const sum = ar.reduce((a,b) => a+b, 0); return sum;

  • + 0 comments

    TypeScript function signature is not correct. It shuld return bigint instead of number.

  • + 0 comments

    RUST:

    fn aVeryBigSum(ar: &[i64]) -> i64 { let sum: i64 = {

        let mut temp_sum: i64 = 0;
    
        for i in ar {
            temp_sum += i;
        }
    
        temp_sum
    };
    
    sum
    

    }

  • + 0 comments

    Java Short Solution

    public static long aVeryBigSum(List ar) { // Write your code here long sum=0; for(long i:(ar)) sum+=i; return sum; }

  • + 1 comment

    I have spent so much time to transform between str and int and do the manual computation digit by digit to ensure the storage. And then it turns out we don't need to consider the storage at all? JUST SUM???