Simple Array Sum

Sort by

recency

|

3425 Discussions

|

  • + 0 comments

    Leveraging Python's built-in sum() function simplifies the code, making it more concise and easier to read, while improving overall clarity and efficiency.

  • + 0 comments

    this is my solution with java

    public static int simpleArraySum(List ar) { int suma = 0; for(int i = 0; i < ar.size(); i++){ suma+=ar.get(i); }

        return suma;
    }
    
  • + 0 comments

    The use of Python's built-in sum() function makes the code concise and easy to understand.

  • + 2 comments

    Using Kotlin

    fun simpleArraySum(ar: Array): Int {

    // Write your code here
    

    return ar.sum()

    }

  • + 0 comments

    Great exercise!