Solution<\/strong><\/p>\npackage org.span;\n\nimport java.io.IOException;\nimport java.util.Scanner;\n\npublic class HourGlass {\n\n static int hourglassSum(int[][] arr) {\n int max = -99999, cur;\n for (int i = 0; i < 4; i++) {\n for (int j = 0; j < 4; j++) {\n cur = arr[i][j] + arr[i][j + 1] + arr[i][j + 2] + arr[i + 1][j + 1] + arr[i + 2][j] + arr[i + 2][j + 1] + arr[i + 2][j + 2];\n if (cur > max) {\n max = cur;\n }\n }\n }\n return max;\n }\n\n private static final Scanner scanner = new Scanner(System.in);\n\n public static void main(String[] args) throws IOException {\n \/*int[][] arr = {\n {1, 1, 1, 0, 0, 0},\n {0, 1, 0, 0, 0, 0},\n {1, 1, 1, 0, 0, 0},\n {0, 0, 2, 4, 4, 0},\n {0, 0, 0, 2, 0, 0},\n {0, 0, 1, 2, 4, 0}\n };*\/\n int[][] arr = {\n {0, -4, -6, 0, -7, -6},\n {-1, -2, -6, -8, -3, -1},\n {-8, -4, -2, -8, -8, -6},\n {-3, -1, -2, -5, -7, -4},\n {-3, -5, -3, -6, -6, -6},\n {-3, -6, 0, -8, -6, -7},\n };\n int result = hourglassSum(arr);\n System.out.println(result);\n }\n}\n\n<\/pre><\/p>\n","protected":false},"excerpt":{"rendered":"Problem Solution<\/p>\n","protected":false},"author":1,"featured_media":694,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[42],"tags":[43],"_links":{"self":[{"href":"http:\/\/tech.learnerandtutor.com\/wp-json\/wp\/v2\/posts\/730"}],"collection":[{"href":"http:\/\/tech.learnerandtutor.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/tech.learnerandtutor.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/tech.learnerandtutor.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/tech.learnerandtutor.com\/wp-json\/wp\/v2\/comments?post=730"}],"version-history":[{"count":0,"href":"http:\/\/tech.learnerandtutor.com\/wp-json\/wp\/v2\/posts\/730\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"http:\/\/tech.learnerandtutor.com\/wp-json\/wp\/v2\/media\/694"}],"wp:attachment":[{"href":"http:\/\/tech.learnerandtutor.com\/wp-json\/wp\/v2\/media?parent=730"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/tech.learnerandtutor.com\/wp-json\/wp\/v2\/categories?post=730"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/tech.learnerandtutor.com\/wp-json\/wp\/v2\/tags?post=730"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}