Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def sumRows(rows: Array[Int][Int], total:Int) : Int = rows match {
- case Nil => total
- case (x:xs) => sumRow(xs, total + fold(0, +, x))
- }
- def sum2dArray(arr:Array[Int][Int]) : Int = {
- sumRows(arr, 0)
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement