https://www.codewars.com/kata/how-many-stairs-will-suzuki-climb-in-20-years/train/java

import java.util.Arrays;

public class Kata
{
    public static long stairsIn20(int[][] stairs)
    {
        return 20 * Arrays.stream(stairs).flatMapToInt(arr -> Arrays.stream(arr)).sum();
    }
}

 

My Solution :

    public static long stairsIn20(int[][] stairs) {
        long result = 0;

        for (int i = 0; i < stairs.length; i++) {
            for (int j = 0; j < stairs[i].length; j++) {
                result += stairs[i][j];
            }
        }
        return result * 20;
    }