You are viewing a single comment's thread. Return to all comments →
Java
List<Integer> lt = new ArrayList<>(); List<Integer> temp = new ArrayList<>(); IntStream.range(0, 4).forEach(i -> { IntStream.range(0, 4).forEach(j -> { temp.add(arr.get(i).get(j)); temp.add(arr.get(i).get(j + 1)); temp.add(arr.get(i).get(j + 2)); temp.add(arr.get(i + 1).get(j + 1)); temp.add(arr.get(i + 2).get(j)); temp.add(arr.get(i + 2).get(j + 1)); temp.add(arr.get(i + 2).get(j + 2)); lt.add(temp.stream().reduce(Integer::sum).get()); temp.clear(); }); } ); System.out.println(lt.stream().max(Integer::compare).get());
Seems like cookies are disabled on this browser, please enable them to open this website
Day 11: 2D Arrays
You are viewing a single comment's thread. Return to all comments →
Java